diff mbox

[v2] mtd: onenand: fix deadlock in onenand_block_markbad

Message ID 1456000068-8862-1-git-send-email-aaro.koskinen@iki.fi
State Accepted
Commit 5e64c29e98bfbba1b527b0a164f9493f3db9e8cb
Headers show

Commit Message

Aaro Koskinen Feb. 20, 2016, 8:27 p.m. UTC
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@iki.fi>
---

	v2: Don't ignore the return value.

	v1: http://lists.infradead.org/pipermail/linux-mtd/2016-February/065582.html

 drivers/mtd/onenand/onenand_base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Artem Bityutskiy Feb. 24, 2016, 11:59 a.m. UTC | #1
Looks good, thanks!

Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

On Sat, 2016-02-20 at 22:27 +0200, Aaro Koskinen wrote:
> 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@iki.fi>
> ---
> 
> 	v2: Don't ignore the return value.
> 
> 	v1: http://lists.infradead.org/pipermail/linux-mtd/2016-Februar
> y/065582.html
> 
>  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;
>  }
Brian Norris Feb. 24, 2016, 6:19 p.m. UTC | #2
On Sat, Feb 20, 2016 at 10:27:48PM +0200, Aaro Koskinen wrote:
> 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")

Good to know onenand has been getting tested sometime in the last 5
year! /s

> Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> ---
> 
> 	v2: Don't ignore the return value.
> 
> 	v1: http://lists.infradead.org/pipermail/linux-mtd/2016-February/065582.html

Marked for -stable and pushed to l2-mtd.git.

Thanks,
Brian
diff mbox

Patch

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;
 }