* [PATCH] clk: visconti: Fix memory leak in visconti_register_pll()
@ 2022-11-22 15:22 Xiu Jianfeng
0 siblings, 0 replies; 4+ messages in thread
From: Xiu Jianfeng @ 2022-11-22 15:22 UTC (permalink / raw)
To: mturquette, sboyd, nobuhiro1.iwamatsu
Cc: linux-clk, linux-arm-kernel, linux-kernel
@pll->rate_table has allocated memory by kmemdup(), if clk_hw_register()
fails, it should be freed, otherwise it will cause memory leak issue,
this patch fixes it.
Fixes: b4cbe606dc36 ("clk: visconti: Add support common clock driver and reset driver")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
drivers/clk/visconti/pll.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/visconti/pll.c b/drivers/clk/visconti/pll.c
index a484cb945d67..1f3234f22667 100644
--- a/drivers/clk/visconti/pll.c
+++ b/drivers/clk/visconti/pll.c
@@ -277,6 +277,7 @@ static struct clk_hw *visconti_register_pll(struct visconti_pll_provider *ctx,
ret = clk_hw_register(NULL, &pll->hw);
if (ret) {
pr_err("failed to register pll clock %s : %d\n", name, ret);
+ kfree(pll->rate_table);
kfree(pll);
pll_hw_clk = ERR_PTR(ret);
}
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] clk: visconti: Fix memory leak in visconti_register_pll()
@ 2022-11-22 15:23 Xiu Jianfeng
2022-11-24 1:22 ` nobuhiro1.iwamatsu
2022-11-29 20:11 ` Stephen Boyd
0 siblings, 2 replies; 4+ messages in thread
From: Xiu Jianfeng @ 2022-11-22 15:23 UTC (permalink / raw)
To: mturquette, sboyd, nobuhiro1.iwamatsu
Cc: linux-clk, linux-arm-kernel, linux-kernel
@pll->rate_table has allocated memory by kmemdup(), if clk_hw_register()
fails, it should be freed, otherwise it will cause memory leak issue,
this patch fixes it.
Fixes: b4cbe606dc36 ("clk: visconti: Add support common clock driver and reset driver")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
drivers/clk/visconti/pll.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/visconti/pll.c b/drivers/clk/visconti/pll.c
index a484cb945d67..1f3234f22667 100644
--- a/drivers/clk/visconti/pll.c
+++ b/drivers/clk/visconti/pll.c
@@ -277,6 +277,7 @@ static struct clk_hw *visconti_register_pll(struct visconti_pll_provider *ctx,
ret = clk_hw_register(NULL, &pll->hw);
if (ret) {
pr_err("failed to register pll clock %s : %d\n", name, ret);
+ kfree(pll->rate_table);
kfree(pll);
pll_hw_clk = ERR_PTR(ret);
}
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] clk: visconti: Fix memory leak in visconti_register_pll()
2022-11-22 15:23 [PATCH] clk: visconti: Fix memory leak in visconti_register_pll() Xiu Jianfeng
@ 2022-11-24 1:22 ` nobuhiro1.iwamatsu
2022-11-29 20:11 ` Stephen Boyd
1 sibling, 0 replies; 4+ messages in thread
From: nobuhiro1.iwamatsu @ 2022-11-24 1:22 UTC (permalink / raw)
To: xiujianfeng, mturquette, sboyd; +Cc: linux-clk, linux-arm-kernel, linux-kernel
Hi Xiu,
Thanks for your patch!
> -----Original Message-----
> From: Xiu Jianfeng <xiujianfeng@huawei.com>
> Sent: Wednesday, November 23, 2022 12:24 AM
> To: mturquette@baylibre.com; sboyd@kernel.org; iwamatsu nobuhiro(岩松 信
> 洋 □SWC◯ACT) <nobuhiro1.iwamatsu@toshiba.co.jp>
> Cc: linux-clk@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org
> Subject: [PATCH] clk: visconti: Fix memory leak in visconti_register_pll()
>
> @pll->rate_table has allocated memory by kmemdup(), if clk_hw_register()
> fails, it should be freed, otherwise it will cause memory leak issue, this patch
> fixes it.
>
> Fixes: b4cbe606dc36 ("clk: visconti: Add support common clock driver and
> reset driver")
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Acked-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Best regards,
Nobuhiro
> ---
> drivers/clk/visconti/pll.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/clk/visconti/pll.c b/drivers/clk/visconti/pll.c index
> a484cb945d67..1f3234f22667 100644
> --- a/drivers/clk/visconti/pll.c
> +++ b/drivers/clk/visconti/pll.c
> @@ -277,6 +277,7 @@ static struct clk_hw *visconti_register_pll(struct
> visconti_pll_provider *ctx,
> ret = clk_hw_register(NULL, &pll->hw);
> if (ret) {
> pr_err("failed to register pll clock %s : %d\n", name, ret);
> + kfree(pll->rate_table);
> kfree(pll);
> pll_hw_clk = ERR_PTR(ret);
> }
> --
> 2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: visconti: Fix memory leak in visconti_register_pll()
2022-11-22 15:23 [PATCH] clk: visconti: Fix memory leak in visconti_register_pll() Xiu Jianfeng
2022-11-24 1:22 ` nobuhiro1.iwamatsu
@ 2022-11-29 20:11 ` Stephen Boyd
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2022-11-29 20:11 UTC (permalink / raw)
To: Xiu Jianfeng, mturquette, nobuhiro1.iwamatsu
Cc: linux-clk, linux-arm-kernel, linux-kernel
Quoting Xiu Jianfeng (2022-11-22 07:23:53)
> @pll->rate_table has allocated memory by kmemdup(), if clk_hw_register()
> fails, it should be freed, otherwise it will cause memory leak issue,
> this patch fixes it.
>
> Fixes: b4cbe606dc36 ("clk: visconti: Add support common clock driver and reset driver")
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
> ---
Applied to clk-next
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-29 20:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-22 15:23 [PATCH] clk: visconti: Fix memory leak in visconti_register_pll() Xiu Jianfeng
2022-11-24 1:22 ` nobuhiro1.iwamatsu
2022-11-29 20:11 ` Stephen Boyd
-- strict thread matches above, loose matches on Subject: below --
2022-11-22 15:22 Xiu Jianfeng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).