[BUG] physmap_flash_probe() frees memory still in use

Matthias Kaehlcke matthias at kaehlcke.net
Fri Jan 30 11:44:12 EST 2009

El Sat, Jan 31, 2009 at 12:52:50AM +0900 Atsushi Nemoto ha dit:

> On Fri, 30 Jan 2009 14:43:18 +0100, Matthias Kaehlcke <matthias at kaehlcke.net> wrote:
> > as i reported earlier in this month
> > (http://lkml.org/lkml/2009/1/12/141) MTD partition names are screwed
> > up in 2.6.29-rcX.
> > 
> > commit 176bf2e0f10ecf1d20a97db3bd5bb2e6ba0b5668 deals with a memory
> > leak and frees the pointer array of mtd_partition after the call to
> > add_mtd_partitions(). the problem is that mtd_table[x]->name still
> > points to the freed memory.
> Oh Yes, I had missed that point.  And looking at physmap driver again,
> I found that del_mtd_partition() and del_mtd_device() are abused.
> Though these APIs are robust enough, deleting right things in right
> order would be better.
> Could you test this patch?  I cannot test it until Monday.

looks good!

Tested-By: Matthias Kaehlcke <matthias at kaehlcke.net>

Matthias Kaehlcke
Embedded Linux Engineer

                If you don't know where you are going,
               you will probably end up somewhere else
                         (Laurence J. Peter)
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

More information about the linux-mtd mailing list