linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: don't leak buffers when ->scan_bbt() fails
@ 2017-05-02  0:04 Brian Norris
  2017-05-02  0:04 ` [PATCH] mtd: nand: don't make vendor-specific code un-set their data pointer Brian Norris
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: Brian Norris @ 2017-05-02  0:04 UTC (permalink / raw)
  To: linux-mtd, Boris Brezillon
  Cc: Richard Weinberger, Brian Norris, Marek Vasut, Cyrille Pitchen,
	Ezequiel Garcia

This bug seems to have been here forever, although we came close to
fixing all of them in [1]!

[1] 11eaf6df1cce ("mtd: nand: Remove BUG() abuse in nand_scan_tail")

Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
The goto isn't *really* necessary, but I thought it'd be more consistent.

Compile tested only

 drivers/mtd/nand/nand_base.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 978242b1213f..e4919f9dece4 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -4794,7 +4794,11 @@ int nand_scan_tail(struct mtd_info *mtd)
 		return 0;
 
 	/* Build bad block table */
-	return chip->scan_bbt(mtd);
+	ret = chip->scan_bbt(mtd);
+	if (ret)
+		goto err_free;
+	return 0;
+
 err_free:
 	if (nbuf) {
 		kfree(nbuf->databuf);
-- 
2.13.0.rc1.294.g07d810a77f-goog

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

end of thread, other threads:[~2017-05-15 20:51 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-02  0:04 [PATCH] mtd: nand: don't leak buffers when ->scan_bbt() fails Brian Norris
2017-05-02  0:04 ` [PATCH] mtd: nand: don't make vendor-specific code un-set their data pointer Brian Norris
2017-05-02  7:15   ` Boris Brezillon
2017-05-02  0:04 ` [PATCH] mtd: nand: drop unneeded module.h include Brian Norris
2017-05-02  7:16   ` Boris Brezillon
2017-05-15 20:50   ` Boris Brezillon
2017-05-02  0:04 ` [PATCH] mtd: nand: free vendor-specific resources in init failure paths Brian Norris
2017-05-02  7:52   ` Boris Brezillon
2017-05-02 16:15     ` Boris Brezillon
2017-05-15 20:49   ` Boris Brezillon
2017-05-02  0:04 ` [PATCH] mtd: nand: orion: don't complain for probe deferral Brian Norris
2017-05-02  7:56   ` Boris Brezillon
2017-05-02  8:07   ` Simon Baatz
2017-05-08 17:46     ` Brian Norris
2017-05-02  0:04 ` [PATCH] mtd: nand: samsung: warn about un-parseable ECC info Brian Norris
2017-05-02  7:57   ` Boris Brezillon
2017-05-15 20:48   ` Boris Brezillon
2017-05-02  0:22 ` [PATCH] mtd: nand: don't leak buffers when ->scan_bbt() fails Ezequiel Garcia
2017-05-02  1:33   ` Brian Norris
2017-05-02  2:21     ` Ezequiel Garcia
2017-05-02  7:17 ` Boris Brezillon
2017-05-15 20:50 ` Boris Brezillon

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