From: Xiu Jianfeng <xiujianfeng@huawei.com> To: <mturquette@baylibre.com>, <sboyd@kernel.org>, <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() Date: Tue, 22 Nov 2022 23:23:53 +0800 [thread overview] Message-ID: <20221122152353.204132-1-xiujianfeng@huawei.com> (raw) @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
WARNING: multiple messages have this Message-ID (diff)
From: Xiu Jianfeng <xiujianfeng@huawei.com> To: <mturquette@baylibre.com>, <sboyd@kernel.org>, <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() Date: Tue, 22 Nov 2022 23:23:53 +0800 [thread overview] Message-ID: <20221122152353.204132-1-xiujianfeng@huawei.com> (raw) @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
next reply other threads:[~2022-11-22 15:27 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-22 15:23 Xiu Jianfeng [this message] 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-24 1:22 ` nobuhiro1.iwamatsu 2022-11-29 20:11 ` Stephen Boyd 2022-11-29 20:11 ` Stephen Boyd -- strict thread matches above, loose matches on Subject: below -- 2022-11-22 15:22 Xiu Jianfeng 2022-11-22 15:22 ` Xiu Jianfeng
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221122152353.204132-1-xiujianfeng@huawei.com \ --to=xiujianfeng@huawei.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mturquette@baylibre.com \ --cc=nobuhiro1.iwamatsu@toshiba.co.jp \ --cc=sboyd@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.