public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: Blackfin NFC: fix invalid free in remove()
@ 2010-08-28 20:42 Mike Frysinger
  2010-08-28 20:42 ` Mike Frysinger
  2010-08-30 12:58 ` Artem Bityutskiy
  0 siblings, 2 replies; 8+ messages in thread
From: Mike Frysinger @ 2010-08-28 20:42 UTC (permalink / raw)
  To: linux-mtd, David Woodhouse
  Cc: uclinux-dist-devel, Andrew Morton, linux-kernel

Since info->mtd isn't dynamically allocated, we shouldn't attempt to
kfree() it.  Otherwise we get random fun corruption when unloading
the driver built as a module.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
note: this should be merged for 2.6.36 and probably sent to stable trees

 drivers/mtd/nand/bf5xx_nand.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index 162c5ea..6fbeefa 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -682,7 +682,6 @@ static int __devinit bf5xx_nand_add_partition(struct bf5xx_nand_info *info)
 static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
 {
 	struct bf5xx_nand_info *info = to_nand_info(pdev);
-	struct mtd_info *mtd = NULL;
 
 	platform_set_drvdata(pdev, NULL);
 
@@ -690,11 +689,7 @@ static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
 	 * and their partitions, then go through freeing the
 	 * resources used
 	 */
-	mtd = &info->mtd;
-	if (mtd) {
-		nand_release(mtd);
-		kfree(mtd);
-	}
+	nand_release(&info->mtd);
 
 	peripheral_free_list(bfin_nfc_pin_req);
 	bf5xx_nand_dma_remove(info);
-- 
1.7.2.2

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

* [PATCH] mtd: Blackfin NFC: fix invalid free in remove()
  2010-08-28 20:42 [PATCH] mtd: Blackfin NFC: fix invalid free in remove() Mike Frysinger
@ 2010-08-28 20:42 ` Mike Frysinger
  2010-08-30 12:58 ` Artem Bityutskiy
  1 sibling, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2010-08-28 20:42 UTC (permalink / raw)
  To: linux-mtd, David Woodhouse
  Cc: uclinux-dist-devel, Andrew Morton, linux-kernel

Since info->mtd isn't dynamically allocated, we shouldn't attempt to
kfree() it.  Otherwise we get random fun corruption when unloading
the driver built as a module.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 drivers/mtd/nand/bf5xx_nand.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index 162c5ea..6fbeefa 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -682,7 +682,6 @@ static int __devinit bf5xx_nand_add_partition(struct bf5xx_nand_info *info)
 static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
 {
 	struct bf5xx_nand_info *info = to_nand_info(pdev);
-	struct mtd_info *mtd = NULL;
 
 	platform_set_drvdata(pdev, NULL);
 
@@ -690,11 +689,7 @@ static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
 	 * and their partitions, then go through freeing the
 	 * resources used
 	 */
-	mtd = &info->mtd;
-	if (mtd) {
-		nand_release(mtd);
-		kfree(mtd);
-	}
+	nand_release(&info->mtd);
 
 	peripheral_free_list(bfin_nfc_pin_req);
 	bf5xx_nand_dma_remove(info);
-- 
1.7.2.2

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

* Re: [PATCH] mtd: Blackfin NFC: fix invalid free in remove()
  2010-08-28 20:42 [PATCH] mtd: Blackfin NFC: fix invalid free in remove() Mike Frysinger
  2010-08-28 20:42 ` Mike Frysinger
@ 2010-08-30 12:58 ` Artem Bityutskiy
  2010-08-30 12:59   ` Artem Bityutskiy
  2010-08-30 13:31   ` Mike Frysinger
  1 sibling, 2 replies; 8+ messages in thread
From: Artem Bityutskiy @ 2010-08-30 12:58 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: David Woodhouse, Andrew Morton, linux-mtd, linux-kernel,
	uclinux-dist-devel

On Sat, 2010-08-28 at 16:42 -0400, Mike Frysinger wrote:
> Since info->mtd isn't dynamically allocated, we shouldn't attempt to
> kfree() it.  Otherwise we get random fun corruption when unloading
> the driver built as a module.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> note: this should be merged for 2.6.36 and probably sent to stable trees

You send the same patch 2 times once with this note and the other time
without this note. Which one should be ignored?

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: [PATCH] mtd: Blackfin NFC: fix invalid free in remove()
  2010-08-30 12:58 ` Artem Bityutskiy
@ 2010-08-30 12:59   ` Artem Bityutskiy
  2010-08-30 13:32     ` [Uclinux-dist-devel] " Mike Frysinger
  2010-08-30 13:31   ` Mike Frysinger
  1 sibling, 1 reply; 8+ messages in thread
From: Artem Bityutskiy @ 2010-08-30 12:59 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: David Woodhouse, Andrew Morton, linux-mtd, linux-kernel,
	uclinux-dist-devel

On Mon, 2010-08-30 at 15:58 +0300, Artem Bityutskiy wrote:
> On Sat, 2010-08-28 at 16:42 -0400, Mike Frysinger wrote:
> > Since info->mtd isn't dynamically allocated, we shouldn't attempt to
> > kfree() it.  Otherwise we get random fun corruption when unloading
> > the driver built as a module.
> > 
> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> > ---
> > note: this should be merged for 2.6.36 and probably sent to stable trees
> 
> You send the same patch 2 times once with this note and the other time
> without this note. Which one should be ignored?

I guess it is 2.6.36 material. Also, if you want this in -stable, add
corresponding CC please.

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: [Uclinux-dist-devel] [PATCH] mtd: Blackfin NFC: fix invalid free in remove()
  2010-08-30 12:58 ` Artem Bityutskiy
  2010-08-30 12:59   ` Artem Bityutskiy
@ 2010-08-30 13:31   ` Mike Frysinger
  1 sibling, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2010-08-30 13:31 UTC (permalink / raw)
  To: dedekind1; +Cc: uclinux-dist-devel, Andrew Morton, linux-mtd, linux-kernel

On Mon, Aug 30, 2010 at 08:58, Artem Bityutskiy wrote:
> On Sat, 2010-08-28 at 16:42 -0400, Mike Frysinger wrote:
>> Since info->mtd isn't dynamically allocated, we shouldn't attempt to
>> kfree() it.  Otherwise we get random fun corruption when unloading
>> the driver built as a module.
>>
>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> ---
>> note: this should be merged for 2.6.36 and probably sent to stable trees
>
> You send the same patch 2 times once with this note and the other time
> without this note. Which one should be ignored?

they're the same thing.  i used a wrong option with git-send-email.
-mike

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

* Re: [Uclinux-dist-devel] [PATCH] mtd: Blackfin NFC: fix invalid free in remove()
  2010-08-30 12:59   ` Artem Bityutskiy
@ 2010-08-30 13:32     ` Mike Frysinger
  2010-08-30 15:10       ` Artem Bityutskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2010-08-30 13:32 UTC (permalink / raw)
  To: dedekind1; +Cc: uclinux-dist-devel, Andrew Morton, linux-mtd, linux-kernel

On Mon, Aug 30, 2010 at 08:59, Artem Bityutskiy wrote:
> On Mon, 2010-08-30 at 15:58 +0300, Artem Bityutskiy wrote:
>> On Sat, 2010-08-28 at 16:42 -0400, Mike Frysinger wrote:
>> > Since info->mtd isn't dynamically allocated, we shouldn't attempt to
>> > kfree() it.  Otherwise we get random fun corruption when unloading
>> > the driver built as a module.
>> >
>> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> > ---
>> > note: this should be merged for 2.6.36 and probably sent to stable trees
>>
>> You send the same patch 2 times once with this note and the other time
>> without this note. Which one should be ignored?
>
> I guess it is 2.6.36 material. Also, if you want this in -stable, add
> corresponding CC please.

once it gets merged, then i can notify the stable guys
-mike

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

* Re: [Uclinux-dist-devel] [PATCH] mtd: Blackfin NFC: fix invalid free in remove()
  2010-08-30 13:32     ` [Uclinux-dist-devel] " Mike Frysinger
@ 2010-08-30 15:10       ` Artem Bityutskiy
  2010-08-30 15:14         ` Mike Frysinger
  0 siblings, 1 reply; 8+ messages in thread
From: Artem Bityutskiy @ 2010-08-30 15:10 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: uclinux-dist-devel, Andrew Morton, linux-mtd, linux-kernel

On Mon, 2010-08-30 at 09:32 -0400, Mike Frysinger wrote:
> On Mon, Aug 30, 2010 at 08:59, Artem Bityutskiy wrote:
> > On Mon, 2010-08-30 at 15:58 +0300, Artem Bityutskiy wrote:
> >> On Sat, 2010-08-28 at 16:42 -0400, Mike Frysinger wrote:
> >> > Since info->mtd isn't dynamically allocated, we shouldn't attempt to
> >> > kfree() it.  Otherwise we get random fun corruption when unloading
> >> > the driver built as a module.
> >> >
> >> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> >> > ---
> >> > note: this should be merged for 2.6.36 and probably sent to stable trees
> >>
> >> You send the same patch 2 times once with this note and the other time
> >> without this note. Which one should be ignored?
> >
> > I guess it is 2.6.36 material. Also, if you want this in -stable, add
> > corresponding CC please.
> 
> once it gets merged, then i can notify the stable guys

AFAIK, this is not the way they prefer to work. The right protocol is
that you add 'Cc: stable@kernel.org' to the commit message, ane they
pick the patch. I might be mistaken, but AFAIK this is the way.

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: [Uclinux-dist-devel] [PATCH] mtd: Blackfin NFC: fix invalid free in remove()
  2010-08-30 15:10       ` Artem Bityutskiy
@ 2010-08-30 15:14         ` Mike Frysinger
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2010-08-30 15:14 UTC (permalink / raw)
  To: dedekind1; +Cc: uclinux-dist-devel, Andrew Morton, linux-mtd, linux-kernel

On Mon, Aug 30, 2010 at 11:10, Artem Bityutskiy wrote:
> On Mon, 2010-08-30 at 09:32 -0400, Mike Frysinger wrote:
>> On Mon, Aug 30, 2010 at 08:59, Artem Bityutskiy wrote:
>> > On Mon, 2010-08-30 at 15:58 +0300, Artem Bityutskiy wrote:
>> >> On Sat, 2010-08-28 at 16:42 -0400, Mike Frysinger wrote:
>> >> > Since info->mtd isn't dynamically allocated, we shouldn't attempt to
>> >> > kfree() it.  Otherwise we get random fun corruption when unloading
>> >> > the driver built as a module.
>> >> >
>> >> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> >> > ---
>> >> > note: this should be merged for 2.6.36 and probably sent to stable trees
>> >>
>> >> You send the same patch 2 times once with this note and the other time
>> >> without this note. Which one should be ignored?
>> >
>> > I guess it is 2.6.36 material. Also, if you want this in -stable, add
>> > corresponding CC please.
>>
>> once it gets merged, then i can notify the stable guys
>
> AFAIK, this is not the way they prefer to work. The right protocol is
> that you add 'Cc: stable@kernel.org' to the commit message, ane they
> pick the patch. I might be mistaken, but AFAIK this is the way.

np ... i'm not claiming to know more than you ;)
-mike

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

end of thread, other threads:[~2010-08-30 15:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-28 20:42 [PATCH] mtd: Blackfin NFC: fix invalid free in remove() Mike Frysinger
2010-08-28 20:42 ` Mike Frysinger
2010-08-30 12:58 ` Artem Bityutskiy
2010-08-30 12:59   ` Artem Bityutskiy
2010-08-30 13:32     ` [Uclinux-dist-devel] " Mike Frysinger
2010-08-30 15:10       ` Artem Bityutskiy
2010-08-30 15:14         ` Mike Frysinger
2010-08-30 13:31   ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox