mtd: onenand: fix deadlock in onenand_block_markbad

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Mar 24 11:59:07 PDT 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=5e64c29e98bfbba1b527b0a164f9493f3db9e8cb
Commit:     5e64c29e98bfbba1b527b0a164f9493f3db9e8cb
Parent:     3b5394a3ccffbfa1d1d448d48742853a862822c4
Author:     Aaro Koskinen <aaro.koskinen at iki.fi>
AuthorDate: Sat Feb 20 22:27:48 2016 +0200
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed Feb 24 10:06:46 2016 -0800

    mtd: onenand: fix deadlock in onenand_block_markbad
    
    Commit 5942ddbc500d ("mtd: introduce mtd_block_markbad interface")
    incorrectly changed onenand_block_markbad() to call mtd_block_markbad
    instead of onenand_chip's block_markbad function. As a result the function
    will now recurse and deadlock. Fix by reverting the change.
    
    Fixes: 5942ddbc500d ("mtd: introduce mtd_block_markbad interface")
    Signed-off-by: Aaro Koskinen <aaro.koskinen at iki.fi>
    Acked-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Cc: <stable at vger.kernel.org>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/onenand/onenand_base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 43b3392..652d018 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -2599,6 +2599,7 @@ static int onenand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
  */
 static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
 {
+	struct onenand_chip *this = mtd->priv;
 	int ret;
 
 	ret = onenand_block_isbad(mtd, ofs);
@@ -2610,7 +2611,7 @@ static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
 	}
 
 	onenand_get_device(mtd, FL_WRITING);
-	ret = mtd_block_markbad(mtd, ofs);
+	ret = this->block_markbad(mtd, ofs);
 	onenand_release_device(mtd);
 	return ret;
 }



More information about the linux-mtd-cvs mailing list