cpufreq: qcom-hw: fix dereferencing freed memory 'data'
authorShawn Guo <shawn.guo@linaro.org>
Sun, 28 Feb 2021 01:33:19 +0000 (09:33 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Mar 2021 16:06:33 +0000 (17:06 +0100)
[ Upstream commit 02fc409540303801994d076fcdb7064bd634dbf3 ]

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>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/cpufreq/qcom-cpufreq-hw.c

index 2726e77..5cdd20e 100644 (file)
@@ -368,7 +368,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;