From: James Hilliard <james.hilliard1@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Thomas Gleixner <tglx@kernel.org>,
"Artem B. Bityuckiy" <dedekind@infradead.org>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
James Hilliard <james.hilliard1@gmail.com>
Subject: [PATCH] mtd: rawnand: stop BBT creation when the marker scan fails
Date: Tue, 03 Nov 2026 22:52:39 -0700 [thread overview]
Message-ID: <20261103-submit-rawnand-bbt-scan-error-v1-v1-1-0bef8334198c@gmail.com> (raw)
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>
reply other threads:[~2026-11-04 5:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103-submit-rawnand-bbt-scan-error-v1-v1-1-0bef8334198c@gmail.com \
--to=james.hilliard1@gmail.com \
--cc=dedekind@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=tglx@kernel.org \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®