[PATCH] powerpc/pseries/hotplug-cpu: Fix memleak when cpus node not exist
Zhang Xiaoxu
zhangxiaoxu5 at huawei.com
Tue Nov 10 23:30:29 AEDT 2020
From: zhangxiaoxu <zhangxiaoxu5 at huawei.com>
If the cpus nodes not exist, we lost to free the 'cpu_drcs', which
will leak memory.
Fixes: a0ff72f9f5a7 ("powerpc/pseries/hotplug-cpu: Remove double free in error path")
Reported-by: Hulk Robot <hulkci at huawei.com>
Signed-off-by: zhangxiaoxu <zhangxiaoxu5 at huawei.com>
---
arch/powerpc/platforms/pseries/hotplug-cpu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index f2837e33bf5d..4bb1c9f2bb11 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -743,6 +743,7 @@ static int dlpar_cpu_add_by_count(u32 cpus_to_add)
parent = of_find_node_by_path("/cpus");
if (!parent) {
pr_warn("Could not find CPU root node in device tree\n");
+ kfree(cpu_drcs);
return -1;
}
--
2.25.4
More information about the Linuxppc-dev
mailing list