[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20090225.103140.155095402.nemoto@toshiba-tops.co.jp>
Date: Wed, 25 Feb 2009 10:31:40 +0900 (JST)
From: Atsushi Nemoto <anemo@....ocn.ne.jp>
To: s.hauer@...gutronix.de
Cc: linux-mtd@...ts.infradead.org, dwmw2@...radead.org,
linux-kernel@...r.kernel.org, vapier.adi@...il.com
Subject: Re: [PATCH] physmap: Fix leak of memory returned by
parse_mtd_partitions
On Tue, 24 Feb 2009 16:29:58 +0100, Sascha Hauer <s.hauer@...gutronix.de> wrote:
> > The physmap patch has another bug and fixes are on the way mainline:
> >
> > http://git.infradead.org/mtd-2.6.git?a=commit;h=e480814f138cd5d78a8efe397756ba6b6518fdb6
> >
> > But this seems not enough, as you wrote. If multiple mtd have same
> > mtd-id, bad things can happen. And more seriously, if I load physmap
> > driver _again_ after unload, cmdlinepart will return a freed pointer
> > on the second time.
> >
> > Hmm, little memory leak is less serious than crash. Now I start
> > thinking reverting the commit 176bf2e0 will be best for 2.6.29
> > release.
>
> Even when reverting the commit the same problem still exists because the
> array then gets freed in physmap_flash_remove(). This won't hurt me
> though because I never use mtd drivers as modules.
If the commit reverted, kfree() in physmap_flash_remove never be
called due to another bug (info->nr_parts is not set properly). But
unloading the physmap module will lead crash anyway since master mtd
device will be freed without deleting slave mtd devices if cmdlinepart
was used.
So I think either reverting the commit or applying the above fix in
mtd-2.6 git tree can fix regression from 2.6.28. Both work well
unless unloading the physmap module after booting with mtdparts=
option.
---
Atsushi Nemoto
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists