stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BACKPORT PATCH] mtd: nand: fix return value check for bad block status
@ 2018-07-03 13:34 Abhishek Sahu
  2018-07-05 18:03 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Abhishek Sahu @ 2018-07-03 13:34 UTC (permalink / raw)
  To: stable
  Cc: linux-mtd, Miquel Raynal, linux-arm-msm, Abhishek Sahu,
	Boris Brezillon

commit e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34 upstream.

Positive return value from read_oob() is making false BAD
blocks. For some of the NAND controllers, OOB bytes will be
protected with ECC and read_oob() will return number of bitflips.
If there is any bitflip in ECC protected OOB bytes for BAD block
status page, then that block is getting treated as BAD.

Fixes: c120e75e0e7d ("mtd: nand: use read_oob() instead of cmdfunc() for bad block check")
Cc: <stable@vger.kernel.org>
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
[backported to 4.14.y]
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
---

This is backported patch for failed patch mentioned in
https://www.spinics.net/lists/stable/msg245833.html
The failure happened due to file rename.

 drivers/mtd/nand/nand_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 528e04f..d410de3 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -440,7 +440,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs)
 
 	for (; page < page_end; page++) {
 		res = chip->ecc.read_oob(mtd, chip, page);
-		if (res)
+		if (res < 0)
 			return res;
 
 		bad = chip->oob_poi[chip->badblockpos];
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc.
is a member of Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [BACKPORT PATCH] mtd: nand: fix return value check for bad block status
  2018-07-03 13:34 [BACKPORT PATCH] mtd: nand: fix return value check for bad block status Abhishek Sahu
@ 2018-07-05 18:03 ` Greg KH
  2018-07-05 18:06   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2018-07-05 18:03 UTC (permalink / raw)
  To: Abhishek Sahu
  Cc: stable, linux-mtd, Miquel Raynal, linux-arm-msm, Boris Brezillon

On Tue, Jul 03, 2018 at 07:04:05PM +0530, Abhishek Sahu wrote:
> commit e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34 upstream.

No it is not :(

Please fix up and resend.

greg k-h

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

* Re: [BACKPORT PATCH] mtd: nand: fix return value check for bad block status
  2018-07-05 18:03 ` Greg KH
@ 2018-07-05 18:06   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2018-07-05 18:06 UTC (permalink / raw)
  To: Abhishek Sahu
  Cc: stable, linux-mtd, Miquel Raynal, linux-arm-msm, Boris Brezillon

On Thu, Jul 05, 2018 at 08:03:53PM +0200, Greg KH wrote:
> On Tue, Jul 03, 2018 at 07:04:05PM +0530, Abhishek Sahu wrote:
> > commit e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34 upstream.
> 
> No it is not :(
> 
> Please fix up and resend.

Ugh, my fault, nevermind, now queued up.

greg k-h

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

end of thread, other threads:[~2018-07-05 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-03 13:34 [BACKPORT PATCH] mtd: nand: fix return value check for bad block status Abhishek Sahu
2018-07-05 18:03 ` Greg KH
2018-07-05 18:06   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).