[PATCH] bus: vexpress-config: fix OF node leak in vexpress_syscfg_probe()

zhaofeng2 at cmss.chinamobile.com zhaofeng2 at cmss.chinamobile.com
Thu Nov 26 23:42:15 PST 2026


From: Zhao Feng <zhaofeng2 at cmss.chinamobile.com>

vexpress_syscfg_probe() calls of_parse_phandle() to obtain
bridge_np for the "arm,vexpress,config-bridge" property inside
a for_each_compatible_node() loop, but the returned device node
reference is never released, leaking a reference on every
matching iteration.

Drop the reference with of_node_put() once the node is no
longer needed.

Signed-off-by: Zhao Feng <zhaofeng2 at cmss.chinamobile.com>
---
Verified against current tree. Leak found by code inspection
(OF reference-counting audit of vexpress_syscfg_probe()).

 bus/vexpress-config.c | 5 +----++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/bus/vexpress-config.c
+++ b/drivers/bus/vexpress-config.c
@@ -393,10 +393,13 @@
 		struct device_node *bridge_np;
 
 		bridge_np = of_parse_phandle(node, "arm,vexpress,config-bridge", 0);
-		if (bridge_np != pdev->dev.parent->of_node)
+		if (bridge_np != pdev->dev.parent->of_node) {
+			of_node_put(bridge_np);
 			continue;
+		}
 
 		of_platform_populate(node, NULL, NULL, &pdev->dev);
+		of_node_put(bridge_np);
 	}
 
 	return 0;





More information about the linux-arm-kernel mailing list