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

Brian Masney masneyb at kernel.org
Mon Nov 30 09:47:03 PST 2026


Hi Guangshuo,

> 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);

The fix is correct however the & doesn't line up with the dev parameter
above.

Brian

-- 
Brian Masney <masneyb at kernel.org>



More information about the linux-arm-kernel mailing list