[PATCH] bus: arm-cci: fix OF node leak in __cci_ace_get_port()
From: zhaofeng2
Date: Fri Nov 27 2026 - 02:43:38 EST
From: Zhao Feng <zhaofeng2@xxxxxxxxxxxxxxxxxxxx>
__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@xxxxxxxxxxxxxxxxxxxx>
---
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;
}