[PATCH] mtd: mtdpart: break it as soon as we parse out the partitions

Artem Bityutskiy dedekind1 at gmail.com
Fri Aug 24 11:54:49 EDT 2012


On Sat, 2012-08-18 at 13:00 -0400, Huang Shijie wrote:
> We may cause a memory leak when the @types has more then one parser.
> 
> Take the `default_mtd_part_types` for example. The default_mtd_part_types has
> two parsers now: `cmdlinepart` and `ofpart`.
> 
> Assume the following case:
> The kernel command line sets the partitions like:
> 	#gpmi-nand:20m(boot),20m(kernel),1g(rootfs),-(user)
> But the devicetree file(such as arch/arm/boot/dts/imx28-evk.dts) also sets
> the same partitions as the kernel command line does.
> 
> In the current code, the partitions parsed out by the `ofpart` will
> overwrite the @pparts which has already set by the `cmdlinepart` parser,
> and the the partitions parsed out by the `cmdlinepart` is missed.
> A memory leak occurs.
> 
> So we should break the code as soon as we parse out the partitions,
> In actually, this patch makes a priority order between the parsers.
> If one parser has already parsed out the partitions successfully,
> it's no need to use another parser anymore.
> 
> Signed-off-by: Huang Shijie <shijie8 at gmail.com>

Pushed to l2-mtd.git with "Cc: stable at vger.kernel.org" - do you agree
with that?

Thanks!

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120824/94fba575/attachment.sig>


More information about the linux-mtd mailing list