Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] bus: arm-cci: fix of_node_put() leak in __cci_ace_get_port()
@ 2026-04-17  2:45 Ashutosh Desai
  2026-05-07  0:12 ` Ashutosh Desai
  0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread

* Re: [PATCH] bus: arm-cci: fix of_node_put() leak in __cci_ace_get_port()
  2026-04-17  2:45 [PATCH] bus: arm-cci: fix of_node_put() leak in __cci_ace_get_port() Ashutosh Desai
@ 2026-05-07  0:12 ` Ashutosh Desai
  0 siblings, 0 replies; 2+ messages in thread
From: Ashutosh Desai @ 2026-05-07  0:12 UTC (permalink / raw)
  To: lpieralisi, nico, linux-kernel, stable; +Cc: Ashutosh Desai

Hi Lorenzo, Nicolas,

Just a gentle ping on this patch from a few weeks ago - no rush at all,
I know you're busy.

https://lore.kernel.org/linux-kernel/20260417024545.141289-1-ashutoshdesai993@gmail.com/

Happy to revise anything if needed. Thanks for your time!

Ashutosh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-07  0:12 UTC | newest]

Thread overview: 2+ messages (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
2026-05-07  0:12 ` Ashutosh Desai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox