[PATCH] clk: visconti: Fix potential use-after-free of provider data

Guangshuo Li liguangshuo at mail.sdu.edu.cn
Sat Nov 28 01:46:24 PST 2026


Unbinding the clock driver frees its managed onecell data without
removing the OF clock provider. A subsequent clock lookup can access
that freed data.

Use managed provider registration to remove it before freeing the data.

This issue was found by our static analysis tool under development.

Fixes: b4cbe606dc36 ("clk: visconti: Add support common clock driver and reset driver")
Signed-off-by: Guangshuo Li <liguangshuo at mail.sdu.edu.cn>
---
 drivers/clk/visconti/clkc-tmpv770x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/visconti/clkc-tmpv770x.c b/drivers/clk/visconti/clkc-tmpv770x.c
index 1e2e8d6437fe..df5196f11219 100644
--- a/drivers/clk/visconti/clkc-tmpv770x.c
+++ b/drivers/clk/visconti/clkc-tmpv770x.c
@@ -347,7 +347,8 @@ static int visconti_clk_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	return of_clk_add_hw_provider(np, of_clk_hw_onecell_get, &ctx->clk_data);
+	return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
+					 &ctx->clk_data);
 }
 
 static const struct of_device_id visconti_clk_ids[] = {

base-commit: d8f05ec001e838cdb94fc14efa7c411e676f9ab9
-- 
2.43.0




More information about the linux-arm-kernel mailing list