From: Miquel Raynal <miquel.raynal@bootlin.com>
To: sashiko-bot@kernel.org
Cc: "Gabor Juhos" <j4g8y7@gmail.com>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"Boris Brezillon" <boris.brezillon@collabora.com>,
sashiko-reviews@lists.linux.dev, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: spinand: set request type explicitly in spinand_{is,mark}bad() functions
Date: Wed, 18 Nov 2026 09:45:32 +0100 [thread overview]
Message-ID: <87wlqajzo3.fsf@bootlin.com> (raw)
In-Reply-To: <sashiko-outbox-219169@kernel.org> (sashiko-bot@kernel.org's message of "Tue, 17 Nov 2026 16:27:11 +0000")
Hi Gabor,
On 17/11/2026 at 16:27:11 GMT, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found no new issues
> in this patch, but noticed 1 related pre-existing issue it does not
> introduce:
> - [Critical] mtd: spinand: 1-byte bad block marker overlap in
> ooblayout_free() [1]
> --
>
> commit cd3136a28caa4c65d360f664085cbb1e630acb0f
> Author: Gabor Juhos <j4g8y7@gmail.com>
>
> mtd: spinand: set request type explicitly in spinand_{is,mark}bad() functions
>
> This commit explicitly sets req.type to NAND_PAGE_READ in spinand_isbad()
> and NAND_PAGE_WRITE in spinand_markbad().
>
> Link: https://sashiko.dev/#/log/192383
>
>> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
>> index 18bba02fbd31f..35bcb4a8861b4 100644
>> --- a/drivers/mtd/nand/spi/core.c
>> +++ b/drivers/mtd/nand/spi/core.c
>> @@ -1105,6 +1105,7 @@ static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos)
>> struct spinand_device *spinand = nand_to_spinand(nand);
>> u8 marker[2] = { };
>> struct nand_page_io_req req = {
>> + .type = NAND_PAGE_READ,
>> .pos = *pos,
>> .ooblen = sizeof(marker),
>> .ooboffs = 0,
>
> [Severity: Critical]
> This problem wasn't introduced by this patch, but can the 2-byte marker[]
> read in spinand_isbad() [1] collide with free OOB space on chips that
> reserve only 1 byte for the bad block marker?
>
> spinand_isbad() treats a block as bad whenever marker[0] != 0xff ||
> marker[1] != 0xff, reading OOB offsets 0 and 1. However, several vendor
> ooblayout_free() callbacks expose OOB offset 1 as free space:
>
> drivers/mtd/nand/spi/gigadevice.c:gd5fxgq4xa_ooblayout_free() {
The bug is in the gigadevice driver. It was arbtrarily decided to keep
using 2 bytes BBM like in the raw NAND world.
You may fix this driver in a separate patch, but that is not a
prerequisite for me.
However, why is this not stable material?
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
prev parent reply other threads:[~2026-11-18 8:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 16:20 [PATCH] mtd: spinand: set request type explicitly in spinand_{is,mark}bad() functions Gabor Juhos
2026-11-17 16:27 ` sashiko-bot
2026-11-18 8:45 ` Miquel Raynal [this message]
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=87wlqajzo3.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=boris.brezillon@collabora.com \
--cc=j4g8y7@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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