* [PATCH -next] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_driver_probe()
@ 2022-11-22 12:46 Xiu Jianfeng
2022-11-22 13:15 ` Manivannan Sadhasivam
2022-11-24 4:46 ` Viresh Kumar
0 siblings, 2 replies; 4+ messages in thread
From: Xiu Jianfeng @ 2022-11-22 12:46 UTC (permalink / raw)
To: agross, andersson, konrad.dybcio, rafael, viresh.kumar, mani
Cc: linux-arm-msm, linux-pm, linux-kernel
If devm_clk_hw_register() fails, clk_init.name should be freed before
return error, otherwise will cause memory leak issue, fix it.
Fixes: 84063a1cbe9e ("cpufreq: qcom-hw: Add CPU clock provider support")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
drivers/cpufreq/qcom-cpufreq-hw.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index 1bd1e9ae5308..340fed35e45d 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -723,6 +723,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
ret = devm_clk_hw_register(dev, &data->cpu_clk);
if (ret < 0) {
dev_err(dev, "Failed to register clock %d: %d\n", i, ret);
+ kfree(clk_init.name);
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_driver_probe()
2022-11-22 12:46 [PATCH -next] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_driver_probe() Xiu Jianfeng
@ 2022-11-22 13:15 ` Manivannan Sadhasivam
2022-11-24 4:46 ` Viresh Kumar
1 sibling, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2022-11-22 13:15 UTC (permalink / raw)
To: Xiu Jianfeng
Cc: agross, andersson, konrad.dybcio, rafael, viresh.kumar,
linux-arm-msm, linux-pm, linux-kernel
On Tue, Nov 22, 2022 at 08:46:27PM +0800, Xiu Jianfeng wrote:
> If devm_clk_hw_register() fails, clk_init.name should be freed before
> return error, otherwise will cause memory leak issue, fix it.
>
> Fixes: 84063a1cbe9e ("cpufreq: qcom-hw: Add CPU clock provider support")
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Thanks,
Mani
> ---
> drivers/cpufreq/qcom-cpufreq-hw.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> index 1bd1e9ae5308..340fed35e45d 100644
> --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> @@ -723,6 +723,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
> ret = devm_clk_hw_register(dev, &data->cpu_clk);
> if (ret < 0) {
> dev_err(dev, "Failed to register clock %d: %d\n", i, ret);
> + kfree(clk_init.name);
> return ret;
> }
>
> --
> 2.17.1
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_driver_probe()
2022-11-22 12:46 [PATCH -next] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_driver_probe() Xiu Jianfeng
2022-11-22 13:15 ` Manivannan Sadhasivam
@ 2022-11-24 4:46 ` Viresh Kumar
1 sibling, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2022-11-24 4:46 UTC (permalink / raw)
To: Xiu Jianfeng
Cc: agross, andersson, konrad.dybcio, rafael, mani, linux-arm-msm,
linux-pm, linux-kernel
On 22-11-22, 20:46, Xiu Jianfeng wrote:
> If devm_clk_hw_register() fails, clk_init.name should be freed before
> return error, otherwise will cause memory leak issue, fix it.
>
> Fixes: 84063a1cbe9e ("cpufreq: qcom-hw: Add CPU clock provider support")
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
> ---
> drivers/cpufreq/qcom-cpufreq-hw.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> index 1bd1e9ae5308..340fed35e45d 100644
> --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> @@ -723,6 +723,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
> ret = devm_clk_hw_register(dev, &data->cpu_clk);
> if (ret < 0) {
> dev_err(dev, "Failed to register clock %d: %d\n", i, ret);
> + kfree(clk_init.name);
> return ret;
> }
Squashed with the original commit and added your SoB. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH -next] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_driver_probe()
@ 2022-11-22 12:35 Xiu Jianfeng
0 siblings, 0 replies; 4+ messages in thread
From: Xiu Jianfeng @ 2022-11-22 12:35 UTC (permalink / raw)
To: agross, andersson, konrad.dybcio, rafael, viresh.kumar, mani
Cc: linux-arm-msm, linux-pm, linux-kernel
If devm_clk_hw_register() fails, clk_init.name should be freed before
return error, otherwise will cause memory leak issue, fix it.
Fixes: 84063a1cbe9e ("cpufreq: qcom-hw: Add CPU clock provider support")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
drivers/cpufreq/qcom-cpufreq-hw.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index 1bd1e9ae5308..340fed35e45d 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -723,6 +723,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
ret = devm_clk_hw_register(dev, &data->cpu_clk);
if (ret < 0) {
dev_err(dev, "Failed to register clock %d: %d\n", i, ret);
+ kfree(clk_init.name);
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-24 4:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22 12:46 [PATCH -next] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_driver_probe() Xiu Jianfeng
2022-11-22 13:15 ` Manivannan Sadhasivam
2022-11-24 4:46 ` Viresh Kumar
-- strict thread matches above, loose matches on Subject: below --
2022-11-22 12:35 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).