diff options
author | Navid Emamdoost <navid.emamdoost@gmail.com> | 2019-10-04 13:58:43 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-10 11:25:17 +0100 |
commit | 9f4ca715dae36ff5b737d56165df1b7964a2cb3e (patch) | |
tree | 5b6881b28cb8c71b1cde0143ae5a150fa6b82885 /drivers/of | |
parent | c1cb67a75753979f411c4200794a2b82c0fff225 (diff) | |
download | linux-rt-9f4ca715dae36ff5b737d56165df1b7964a2cb3e.tar.gz |
of: unittest: fix memory leak in unittest_data_add
[ Upstream commit e13de8fe0d6a51341671bbe384826d527afe8d44 ]
In unittest_data_add, a copy buffer is created via kmemdup. This buffer
is leaked if of_fdt_unflatten_tree fails. The release for the
unittest_data buffer is added.
Fixes: b951f9dc7f25 ("Enabling OF selftest to run without machine's devicetree")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Reviewed-by: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/unittest.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 7c6aff761800..87650d42682f 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -1002,6 +1002,7 @@ static int __init unittest_data_add(void) of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node); if (!unittest_data_node) { pr_warn("%s: No tree to attach; not running tests\n", __func__); + kfree(unittest_data); return -ENODATA; } of_node_set_flag(unittest_data_node, OF_DETACHED); |