Thread (2 messages) 2 messages, 2 authors, 6d ago

Re: [PATCH] net: ethernet: ti: cpts: Fix refclk node leak in cpts_of_mux_clk_setup()

From: Simon Horman <horms@kernel.org>
Date: 2026-09-21 11:02:30
Also in: lkml, stable

On Thu, Sep 17, 2026 at 11:46:16AM +0000, Wentao Liang wrote:
quoted hunk ↗ jump to hunk
cpts_of_mux_clk_setup() takes a reference on the "cpts-refclk-mux" child
node that is only released on the mux_fail error path. When the mux clock
provider is registered successfully, the reference is leaked.
of_clk_add_hw_provider() keeps its own reference on the node, so release
the one taken here before returning.

Fixes: a3047a81ba13 ("net: ethernet: ti: cpts: add support for ext rftclk selection")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <redacted>
---
 drivers/net/ethernet/ti/cpts.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index 2ba4c8795d60..372cef13d81e 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -714,6 +714,8 @@ static int cpts_of_mux_clk_setup(struct cpts *cpts, struct device_node *node)
 		goto mux_fail;
 	}
 
+	of_node_put(refclk_np);
+
 	return ret;
I believe that of_node_put() should not be added here, but
rather it should be added to cpts_clk_del_provider().

Otherwise, what ensures that the node hasn't been reclaimed
by the time cpts_clk_del_provider() runs?

-- 
pw-bot: changes-requested
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help