public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Alexander Dahl <ada@thorsis.com>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <tudor.ambarus@linaro.org>,
	Pratyush Yadav <pratyush@kernel.org>,
	Michael Walle <michael@walle.cc>,
	linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	stable@vger.kernel.org,
	Steven Seeger <steven.seeger@flightsystems.net>
Subject: Re: [PATCH 2/2] mtd: rawnand: Bypass a couple of sanity checks during NAND identification
Date: Mon, 13 May 2024 09:05:23 +0200	[thread overview]
Message-ID: <20240513090523.687ad7f4@xps-13> (raw)
In-Reply-To: <20240508-patient-cover-54085f1981d8@thorsis.com>

Hi Alexander,

ada@thorsis.com wrote on Wed, 8 May 2024 08:41:44 +0200:

> Hello Miquel,
> 
> Am Tue, May 07, 2024 at 06:05:46PM +0200 schrieb Miquel Raynal:
> > Early during NAND identification, mtd_info fields have not yet been
> > initialized (namely, writesize and oobsize) and thus cannot be used for
> > sanity checks yet. Of course if there is a misuse of
> > nand_change_read_column_op() so early we won't be warned, but there is
> > anyway no actual check to perform at this stage as we do not yet know
> > the NAND geometry.
> > 
> > So, if the fields are empty, especially mtd->writesize which is *always*
> > set quite rapidly after identification, let's skip the sanity checks.
> > 
> > nand_change_read_column_op() is subject to be used early for ONFI/JEDEC
> > identification in the very unlikely case of:
> > - bitflips appearing in the parameter page,
> > - the controller driver not supporting simple DATA_IN cycles.
> > 
> > Fixes: c27842e7e11f ("mtd: rawnand: onfi: Adapt the parameter page read to constraint controllers")
> > Fixes: daca31765e8b ("mtd: rawnand: jedec: Adapt the parameter page read to constraint controllers")
> > Cc: stable@vger.kernel.org
> > Reported-by: Alexander Dahl <ada@thorsis.com>
> > Closes: https://lore.kernel.org/linux-mtd/20240306-shaky-bunion-d28b65ea97d7@thorsis.com/
> > Reported-by: Steven Seeger <steven.seeger@flightsystems.net>
> > Closes: https://lore.kernel.org/linux-mtd/DM6PR05MB4506554457CF95191A670BDEF7062@DM6PR05MB4506.namprd05.prod.outlook.com/
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  drivers/mtd/nand/raw/nand_base.c | 12 +++++++-----
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> > index 248e654ecefd..a66e73cd68cb 100644
> > --- a/drivers/mtd/nand/raw/nand_base.c
> > +++ b/drivers/mtd/nand/raw/nand_base.c
> > @@ -1440,12 +1440,14 @@ int nand_change_read_column_op(struct nand_chip *chip,
> >  	if (len && !buf)
> >  		return -EINVAL;
> >  
> > -	if (offset_in_page + len > mtd->writesize + mtd->oobsize)
> > -		return -EINVAL;
> > +	if (mtd->writesize) {
> > +		if ((offset_in_page + len > mtd->writesize + mtd->oobsize))
> > +			return -EINVAL;  
> 
> These doubled (( )) are new and I think not necessary?

Oops, true.

Any chances you'll be able to test the patchset?

Same question for Steven!

Cheers,
Miquèl

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

  reply	other threads:[~2024-05-13  7:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07 16:05 [PATCH 0/2] mtd: rawnand: NAND early identification fixes Miquel Raynal
2024-05-07 16:05 ` [PATCH 1/2] mtd: rawnand: Fix the nand_read_data_op() early check Miquel Raynal
2024-05-08  6:36   ` Alexander Dahl
2024-05-07 16:05 ` [PATCH 2/2] mtd: rawnand: Bypass a couple of sanity checks during NAND identification Miquel Raynal
2024-05-08  6:41   ` Alexander Dahl
2024-05-13  7:05     ` Miquel Raynal [this message]
2024-05-14 12:25   ` Sascha Hauer
2024-05-14 17:57   ` Steven Seeger
2024-05-16  7:52     ` Miquel Raynal

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=20240513090523.687ad7f4@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=ada@thorsis.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=steven.seeger@flightsystems.net \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tudor.ambarus@linaro.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