Patchwork [for,2.6.29?,4/4] mtd/maps: blackfin async flash maps: fix up memory leak

login
register
mail settings
Submitter Andrew Morton
Date Feb. 11, 2009, 9:12 p.m.
Message ID <200902112112.n1BLCKlR010256@imap1.linux-foundation.org>
Download mbox | patch
Permalink /patch/22938/
State New, archived
Headers show

Comments

Andrew Morton - Feb. 11, 2009, 9:12 p.m.
From: Mike Frysinger <vapier.adi@gmail.com>

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/mtd/maps/bfin-async-flash.c |    1 +
 1 file changed, 1 insertion(+)
Atsushi Nemoto - Feb. 12, 2009, 12:35 a.m.
On Wed, 11 Feb 2009 13:12:19 -0800, akpm@linux-foundation.org wrote:
> @@ -170,6 +170,7 @@ static int __devinit bfin_flash_probe(st
>  	if (ret > 0) {
>  		pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");
>  		add_mtd_partitions(state->mtd, pdata->parts, ret);
> +		kfree(pdata->parts);
>  
>  	} else if (pdata->nr_parts) {
>  		pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n");

As Matthias Kaehlcke pointed out in mail titled "[BUG]
physmap_flash_probe() frees memory still in use", this fix introduce
another bug.

Revised patch for physmap driver is:
http://lists.infradead.org/pipermail/linux-mtd/2009-February/024590.html

Mike, please update this blackfin patch too.

---
Atsushi Nemoto
Andrew Morton - Feb. 12, 2009, 12:42 a.m.
On Thu, 12 Feb 2009 09:35:31 +0900 (JST)
Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:

> On Wed, 11 Feb 2009 13:12:19 -0800, akpm@linux-foundation.org wrote:
> > @@ -170,6 +170,7 @@ static int __devinit bfin_flash_probe(st
> >  	if (ret > 0) {
> >  		pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");
> >  		add_mtd_partitions(state->mtd, pdata->parts, ret);
> > +		kfree(pdata->parts);
> >  
> >  	} else if (pdata->nr_parts) {
> >  		pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n");
> 
> As Matthias Kaehlcke pointed out in mail titled "[BUG]
> physmap_flash_probe() frees memory still in use", this fix introduce
> another bug.
> 
> Revised patch for physmap driver is:
> http://lists.infradead.org/pipermail/linux-mtd/2009-February/024590.html
> 
> Mike, please update this blackfin patch too.
> 

I don't have a copy of that patch.  You're on you own, guys..
David Woodhouse - Feb. 14, 2009, 8:57 a.m.
On Wed, 2009-02-11 at 16:42 -0800, Andrew Morton wrote:
>  
> > 
> > Revised patch for physmap driver is:
> >
> http://lists.infradead.org/pipermail/linux-mtd/2009-February/024590.html
> > 
> > Mike, please update this blackfin patch too.
> > 
> 
> I don't have a copy of that patch.  You're on you own, guys..

Er, wasn't your [1/4] actually Nemoto-san's latest physmap patch?

Mike, please can I have an updated version of the blackfin patch?

Nemoto-san, thank you for taking care of this.

Patch

diff -puN drivers/mtd/maps/bfin-async-flash.c~mtd-maps-blackfin-async-flash-maps-fix-up-memory-leak drivers/mtd/maps/bfin-async-flash.c
--- a/drivers/mtd/maps/bfin-async-flash.c~mtd-maps-blackfin-async-flash-maps-fix-up-memory-leak
+++ a/drivers/mtd/maps/bfin-async-flash.c
@@ -170,6 +170,7 @@  static int __devinit bfin_flash_probe(st
 	if (ret > 0) {
 		pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");
 		add_mtd_partitions(state->mtd, pdata->parts, ret);
+		kfree(pdata->parts);
 
 	} else if (pdata->nr_parts) {
 		pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n");