linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: atmel: Check return values for nand_read_data_op
@ 2020-09-14 21:42 Alex Dewar
  2020-09-15  8:10 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Dewar @ 2020-09-14 21:42 UTC (permalink / raw)
  Cc: Alexandre Belloni, Vignesh Raghavendra, Tudor Ambarus,
	Richard Weinberger, Nicolas Ferre, linux-kernel,
	Ludovic Desroches, linux-mtd, Miquel Raynal, Alex Dewar,
	linux-arm-kernel

In atmel_nand_pmecc_read_pg(), nand_read_data_op() is called twice
without the return values being checked for errors. Add these checks.

Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
 drivers/mtd/nand/raw/atmel/nand-controller.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index 309ce410d792..e6ceec8f50dc 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -948,11 +948,17 @@ static int atmel_nand_pmecc_read_pg(struct nand_chip *chip, u8 *buf,
 	if (ret)
 		return ret;
 
-	nand_read_data_op(chip, buf, mtd->writesize, false, false);
-	nand_read_data_op(chip, chip->oob_poi, mtd->oobsize, false, false);
+	ret = nand_read_data_op(chip, buf, mtd->writesize, false, false);
+	if (ret)
+		goto out_disable;
+
+	ret = nand_read_data_op(chip, chip->oob_poi, mtd->oobsize, false, false);
+	if (ret)
+		goto out_disable;
 
 	ret = atmel_nand_pmecc_correct_data(chip, buf, raw);
 
+out_disable:
 	atmel_nand_pmecc_disable(chip, raw);
 
 	return ret;
-- 
2.28.0


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

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

* Re: [PATCH] mtd: rawnand: atmel: Check return values for nand_read_data_op
  2020-09-14 21:42 [PATCH] mtd: rawnand: atmel: Check return values for nand_read_data_op Alex Dewar
@ 2020-09-15  8:10 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2020-09-15  8:10 UTC (permalink / raw)
  To: Alex Dewar
  Cc: Alexandre Belloni, Vignesh Raghavendra, Tudor Ambarus,
	Richard Weinberger, Nicolas Ferre, linux-kernel,
	Ludovic Desroches, linux-mtd, Miquel Raynal, linux-arm-kernel

On Mon, 2020-09-14 at 21:42:44 UTC, Alex Dewar wrote:
> In atmel_nand_pmecc_read_pg(), nand_read_data_op() is called twice
> without the return values being checked for errors. Add these checks.
> 
> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

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

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

end of thread, other threads:[~2020-09-15  8:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 21:42 [PATCH] mtd: rawnand: atmel: Check return values for nand_read_data_op Alex Dewar
2020-09-15  8:10 ` Miquel Raynal

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).