[PATCH] powerpc/powernv: Fix refcount leak bug in idle.c

Liang He windhl at 126.com
Mon Jun 20 16:38:30 AEST 2022


In pnv_parse_cpuidle_dt(), of_find_node_by_path() will return a node
pointer with refcount incremented. We should use of_node_put() in fail
path or when it is not used anymore.

Signed-off-by: Liang He <windhl at 126.com>
---
 arch/powerpc/platforms/powernv/idle.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
index 6f94b808dd39..c1b369c7f507 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -1419,6 +1419,7 @@ static int __init pnv_parse_cpuidle_dt(void)
 	kfree(temp_u32);
 	kfree(temp_u64);
 	kfree(temp_string);
+	of_node_put(np);
 	return rc;
 }
 
-- 
2.25.1



More information about the Linuxppc-dev mailing list