[PATCH 2/2] clk: imxrt1050: Fix potential use-after-free on unbind
Guangshuo Li
liguangshuo at mail.sdu.edu.cn
Sat Nov 28 01:45:39 PST 2026
The OF clock provider retains the managed onecell data after the
driver is unbound. Subsequent clock lookups can access freed memory.
Manage the provider so it is removed before the onecell data is freed.
This issue was found by our static analysis tool under development.
Fixes: 7154b046d8f3 ("clk: imx: Add initial support for i.MXRT1050 clock driver")
Signed-off-by: Guangshuo Li <liguangshuo at mail.sdu.edu.cn>
---
drivers/clk/imx/clk-imxrt1050.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/imx/clk-imxrt1050.c b/drivers/clk/imx/clk-imxrt1050.c
index db152c66d66f..28f4534cbeff 100644
--- a/drivers/clk/imx/clk-imxrt1050.c
+++ b/drivers/clk/imx/clk-imxrt1050.c
@@ -150,7 +150,7 @@ static int imxrt1050_clocks_probe(struct platform_device *pdev)
hws[IMXRT1050_CLK_DMA_MUX] = imx_clk_hw_gate("dmamux0", "ipg", ccm_base + 0x7C, 7);
imx_check_clk_hws(hws, IMXRT1050_CLK_END);
- ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
+ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_hw_data);
if (ret < 0) {
dev_err(dev, "Failed to register clks for i.MXRT1050.\n");
goto unregister_hws;
--
2.43.0
More information about the linux-arm-kernel
mailing list