[PATCH] arm: mach-versatile: Fix refcount leak in v2m

Liang He windhl at 126.com
Fri Jun 17 06:42:13 PDT 2022


In vexpress_flags_set(), of_find_compatible_node() will return a
node pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.

Signed-off-by: Liang He <windhl at 126.com>
---
 arch/arm/mach-versatile/v2m.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-versatile/v2m.c b/arch/arm/mach-versatile/v2m.c
index 79afdf2a90b6..275f0628aa7e 100644
--- a/arch/arm/mach-versatile/v2m.c
+++ b/arch/arm/mach-versatile/v2m.c
@@ -17,6 +17,7 @@ void vexpress_flags_set(u32 data)
 				"arm,vexpress-sysreg");
 
 		base = of_iomap(node, 0);
+		of_node_put(node);
 	}
 
 	if (WARN_ON(!base))
-- 
2.25.1




More information about the linux-arm-kernel mailing list