[PATCH] mtd: rawnand: stop BBT creation when the marker scan fails
Miquel Raynal
miquel.raynal at bootlin.com
Wed Nov 18 01:45:51 PST 2026
On 03/11/2026 at 22:52:39 -07, James Hilliard <james.hilliard1 at gmail.com> wrote:
> create_bbt() returns an error if reading a bad-block marker fails,
This sentence does not mean anything.
> but
> check_create() ignores that result. It can assign version 1 to the
That's also unclear.
> incomplete RAM table and write it to the primary and mirror locations.
> Unscanned factory-bad blocks then appear good in the persisted tables.
Here is a proposal which I believe makes more sense:
mtd: rawnand: abort BBT creation on scan failure
create_bbt() can fail on a non-ECC OOB read error, leaving the RAM BBT
partially populated. It is preferable to bail out early rather than bump
the table versions and write incomplete primary and mirror tables, which
would mark the unscanned factory-bad blocks as good.
> Propagate the scan failure before changing table versions or writing
> either copy. Keep explicit NAND_BBT_CREATE_EMPTY initialization unchanged.
>
> Fixes: eeada24da8bd ("[MTD] NAND: Read only OOB bytes during bad block scan")
> Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
I would prefer if you could write your own commit logs, giving us more
confidence on the work that has been asked. You can use an LLM to
improve/enhance it obviously.
Thanks,
Miquèl
More information about the linux-mtd
mailing list