mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
of: unittest: fix memory leak in unittest_data_add
[ Upstream commite13de8fe0d] 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:b951f9dc7f("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1c2c7b43a2
commit
0228cd262d
@@ -933,6 +933,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);
|
||||
|
||||
Reference in New Issue
Block a user