[PATCH] bus: arm-cci: fix OF node leak in __cci_ace_get_port()

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


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

__cci_ace_get_port() calls of_parse_phandle() to resolve the
"cci-control-port" phandle, but the returned device node
reference is never released on either the success or the
failure path.

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 __cci_ace_get_port()).

 bus/arm-cci.c | 7 +-----++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -167,9 +167,12 @@
 	cci_portn = of_parse_phandle(dn, "cci-control-port", 0);
 	for (i = 0; i < nb_cci_ports; i++) {
 		ace_match = ports[i].type == type;
-		if (ace_match && cci_portn == ports[i].dn)
+		if (ace_match && cci_portn == ports[i].dn) {
+			of_node_put(cci_portn);
 			return i;
-	}
+		}
+	}
+	of_node_put(cci_portn);
 	return -ENODEV;
 }
 





More information about the linux-arm-kernel mailing list