[PATCH] clk: rockchip: Fix memory leak in rockchip_clk_register_pll()
Xiu Jianfeng
xiujianfeng at huawei.com
Tue Nov 22 19:22:37 PST 2022
If clk_register() fails, @pll->rate_table may have allocated memory by
kmemdup(), so it needs to be freed, otherwise will cause memory leak
issue, this patch fixes it.
Fixes: 90c590254051 ("clk: rockchip: add clock type for pll clocks and pll used on rk3066")
Signed-off-by: Xiu Jianfeng <xiujianfeng at huawei.com>
---
drivers/clk/rockchip/clk-pll.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c
index 4b9840994295..dc4ce280d125 100644
--- a/drivers/clk/rockchip/clk-pll.c
+++ b/drivers/clk/rockchip/clk-pll.c
@@ -1200,6 +1200,7 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx,
clk_unregister(mux_clk);
mux_clk = pll_clk;
err_mux:
+ kfree(pll->rate_table);
kfree(pll);
return mux_clk;
}
--
2.17.1
More information about the linux-arm-kernel
mailing list