diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2018-04-12 08:24:52 +0300 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-05-12 10:42:38 +0300 |
commit | 237ea0d4762cc14d0fc80e80d61f0f08e1050c7f (patch) | |
tree | a75c119297bc01792bfe9ecee94bc2c9be4e560f /drivers/mtd/chips | |
parent | 5ac67ce36cfe38b4c104a42ce52c5c8d526f1c95 (diff) | |
download | linux-237ea0d4762cc14d0fc80e80d61f0f08e1050c7f.tar.xz |
mtd: bcm47xxpart: improve handling TRX partition size
When bcm47xxpart finds a TRX partition (container) it's supposed to jump
to the end of it and keep looking for more partitions. TRX and its
subpartitions are handled by a separate parser.
The problem with old code was relying on the length specified in a TRX
header. That isn't reliable as TRX is commonly modified to have checksum
cover only non-changing subpartitions. Otherwise modifying e.g. a rootfs
would result in CRC32 mismatch and bootloader refusing to boot a
firmware.
Fix it by trying better to figure out a real TRX size. We can securely
assume that TRX has to cover all subpartitions and the last one is at
least of a block size in size. Then compare it with a length field.
This makes code more optimal & reliable thanks to skipping data that
shouldn't be parsed.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/mtd/chips')
0 files changed, 0 insertions, 0 deletions