* [PATCH] cpufreq: qcom-hw: fix dereferencing freed memory 'data'
@ 2021-02-28 1:33 Shawn Guo
2021-03-01 4:34 ` Viresh Kumar
0 siblings, 1 reply; 2+ messages in thread
From: Shawn Guo @ 2021-02-28 1:33 UTC (permalink / raw)
To: Viresh Kumar; +Cc: linux-pm, linux-kernel, Shawn Guo
Commit 67fc209b527d ("cpufreq: qcom-hw: drop devm_xxx() calls from
init/exit hooks") introduces an issue of dereferencing freed memory
'data'. Fix it.
Fixes: 67fc209b527d ("cpufreq: qcom-hw: drop devm_xxx() calls from init/exit hooks")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
Viresh,
The issue was introduced by v2 of "cpufreq: qcom-hw: drop devm_xxx()
calls from init/exit hooks", which misses the conversion of 'data->base'
in error path. Sorry!
Shawn
drivers/cpufreq/qcom-cpufreq-hw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index d3c23447b892..bee5d67a8227 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -374,7 +374,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
error:
kfree(data);
unmap_base:
- iounmap(data->base);
+ iounmap(base);
release_region:
release_mem_region(res->start, resource_size(res));
return ret;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cpufreq: qcom-hw: fix dereferencing freed memory 'data'
2021-02-28 1:33 [PATCH] cpufreq: qcom-hw: fix dereferencing freed memory 'data' Shawn Guo
@ 2021-03-01 4:34 ` Viresh Kumar
0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2021-03-01 4:34 UTC (permalink / raw)
To: Shawn Guo; +Cc: linux-pm, linux-kernel
On 28-02-21, 09:33, Shawn Guo wrote:
> Commit 67fc209b527d ("cpufreq: qcom-hw: drop devm_xxx() calls from
> init/exit hooks") introduces an issue of dereferencing freed memory
> 'data'. Fix it.
>
> Fixes: 67fc209b527d ("cpufreq: qcom-hw: drop devm_xxx() calls from init/exit hooks")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
> Viresh,
>
> The issue was introduced by v2 of "cpufreq: qcom-hw: drop devm_xxx()
> calls from init/exit hooks", which misses the conversion of 'data->base'
> in error path. Sorry!
>
> Shawn
>
> drivers/cpufreq/qcom-cpufreq-hw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
> index d3c23447b892..bee5d67a8227 100644
> --- a/drivers/cpufreq/qcom-cpufreq-hw.c
> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c
> @@ -374,7 +374,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
> error:
> kfree(data);
> unmap_base:
> - iounmap(data->base);
> + iounmap(base);
> release_region:
> release_mem_region(res->start, resource_size(res));
> return ret;
Applied. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-01 4:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-28 1:33 [PATCH] cpufreq: qcom-hw: fix dereferencing freed memory 'data' Shawn Guo
2021-03-01 4:34 ` Viresh Kumar
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.