linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mtd: onenand: fix deadlock in onenand_block_markbad
@ 2016-02-20 20:27 Aaro Koskinen
  2016-02-24 11:59 ` Artem Bityutskiy
  2016-02-24 18:19 ` Brian Norris
  0 siblings, 2 replies; 3+ messages in thread
From: Aaro Koskinen @ 2016-02-20 20:27 UTC (permalink / raw)
  To: Artem Bityutskiy, Kyungmin Park, David Woodhouse, linux-mtd; +Cc: Aaro Koskinen

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

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

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

* Re: [PATCH v2] mtd: onenand: fix deadlock in onenand_block_markbad
  2016-02-20 20:27 [PATCH v2] mtd: onenand: fix deadlock in onenand_block_markbad Aaro Koskinen
@ 2016-02-24 11:59 ` Artem Bityutskiy
  2016-02-24 18:19 ` Brian Norris
  1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2016-02-24 11:59 UTC (permalink / raw)
  To: Aaro Koskinen, Kyungmin Park, David Woodhouse, linux-mtd

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;
>  }
-- 
Best Regards,
Artem Bityutskiy

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

* Re: [PATCH v2] mtd: onenand: fix deadlock in onenand_block_markbad
  2016-02-20 20:27 [PATCH v2] mtd: onenand: fix deadlock in onenand_block_markbad Aaro Koskinen
  2016-02-24 11:59 ` Artem Bityutskiy
@ 2016-02-24 18:19 ` Brian Norris
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Norris @ 2016-02-24 18:19 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: Artem Bityutskiy, Kyungmin Park, David Woodhouse, linux-mtd

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

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

end of thread, other threads:[~2016-02-24 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-20 20:27 [PATCH v2] mtd: onenand: fix deadlock in onenand_block_markbad Aaro Koskinen
2016-02-24 11:59 ` Artem Bityutskiy
2016-02-24 18:19 ` Brian Norris

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