]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
mtd: parsers: bcm47xxpart: Fix halfblock reads
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 18 Oct 2022 09:11:29 +0000 (11:11 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 6 Dec 2022 13:45:36 +0000 (14:45 +0100)
commit1356ba3c73e8a16433d83b928bd488d97ab61444
tree21261118dd3e761e3206e5bc409a90526b0a5f7d
parent876c4b703c7d00865f2ff0ae2b80c24de31b738c
mtd: parsers: bcm47xxpart: Fix halfblock reads

BugLink: https://bugs.launchpad.net/bugs/1998843
[ Upstream commit 05e258c6ec669d6d18c494ea03d35962d6f5b545 ]

There is some code in the parser that tries to read 0x8000
bytes into a block to "read in the middle" of the block. Well
that only works if the block is also 0x10000 bytes all the time,
else we get these parse errors as we reach the end of the flash:

spi-nor spi0.0: mx25l1606e (2048 Kbytes)
mtd_read error while parsing (offset: 0x200000): -22
mtd_read error while parsing (offset: 0x201000): -22
(...)

Fix the code to do what I think was intended.

Cc: stable@vger.kernel.org
Fixes: f0501e81fbaa ("mtd: bcm47xxpart: alternative MAGIC for board_data partition")
Cc: Rafał Miłecki <zajec5@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20221018091129.280026-1-linus.walleij@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/mtd/parsers/bcm47xxpart.c