All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails
@ 2026-11-04  5:52 ` James Hilliard
  0 siblings, 0 replies; 4+ messages in thread
From: James Hilliard @ 2026-11-04  5:52 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Thomas Gleixner, Artem B. Bityuckiy
  Cc: linux-mtd, linux-kernel, James Hilliard

create_bbt() returns an error if reading a bad-block marker fails, but
check_create() ignores that result. It can assign version 1 to the
incomplete RAM table and write it to the primary and mirror locations.
Unscanned factory-bad blocks then appear good in the persisted tables.

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@gmail.com>
---
 drivers/mtd/nand/raw/nand_bbt.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c
index b0e7592a2ab7..db9d6458af51 100644
--- a/drivers/mtd/nand/raw/nand_bbt.c
+++ b/drivers/mtd/nand/raw/nand_bbt.c
@@ -1005,8 +1005,11 @@ static int check_create(struct nand_chip *this, uint8_t *buf,
 				continue;
 
 			/* Create the table in memory by scanning the chip(s) */
-			if (!(this->bbt_options & NAND_BBT_CREATE_EMPTY))
-				create_bbt(this, buf, bd, chipsel);
+			if (!(this->bbt_options & NAND_BBT_CREATE_EMPTY)) {
+				res = create_bbt(this, buf, bd, chipsel);
+				if (res)
+					return res;
+			}
 
 			td->version[i] = 1;
 			if (md)

---
base-commit: 30daaf3e7897b4a8d9b72e5b0c86dd6e2a4d7d85
change-id: 20261103-submit-rawnand-bbt-scan-error-v1-1183d881e5b2

Best regards,
--  
James Hilliard <james.hilliard1@gmail.com>


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-18  9:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  5:52 [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails James Hilliard
2026-11-04  5:52 ` James Hilliard
2026-11-18  9:45 ` Miquel Raynal
2026-11-18  9:45   ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.