* [PATCH] bus: arm-cci: fix of_node_put() leak in __cci_ace_get_port()
@ 2026-04-17 2:45 Ashutosh Desai
0 siblings, 0 replies; only message in thread
From: Ashutosh Desai @ 2026-04-17 2:45 UTC (permalink / raw)
To: lpieralisi, nico; +Cc: linux-kernel, stable, Ashutosh Desai
of_parse_phandle() hands back a node with its refcount bumped.
__cci_ace_get_port() uses it only for a pointer comparison against
ports[], then both return paths walk away without ever calling
of_node_put(), leaking the reference each time.
Add the missing of_node_put() on both return paths.
Fixes: ed69bdd8fd9b ("drivers: bus: add ARM CCI support")
Cc: stable@vger.kernel.org
Signed-off-by: Ashutosh Desai <ashutoshdesai993@gmail.com>
---
drivers/bus/arm-cci.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index 7f2baf057128..223b1fe19ba0 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -167,9 +167,12 @@ static int __cci_ace_get_port(struct device_node *dn, int type)
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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-17 2:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-17 2:45 [PATCH] bus: arm-cci: fix of_node_put() leak in __cci_ace_get_port() Ashutosh Desai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox