diff options
author | Huang Shijie <shijie8@gmail.com> | 2012-08-18 13:07:41 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-13 05:38:58 +0900 |
commit | e82df24e733c04385e8d8c32d3062292668bf8c0 (patch) | |
tree | f22327330a1e8e32a6138347aa105d298fb00cdf /net | |
parent | c62f9945efea31db203fd4fb77e830ddffdcabf6 (diff) | |
download | lwn-e82df24e733c04385e8d8c32d3062292668bf8c0.tar.gz lwn-e82df24e733c04385e8d8c32d3062292668bf8c0.zip |
mtd: mtdpart: break it as soon as we parse out the partitions
commit c51803ddba10d80d9f246066802c6e359cf1d44c upstream.
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@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions