Re: [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails

From: Miquel Raynal

Date: Wed Nov 18 2026 - 04:46:02 EST


On 03/11/2026 at 22:52:39 -07, James Hilliard <james.hilliard1@xxxxxxxxx> 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@xxxxxxxxx>

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