thermal: cpu_cooling: Avoid accessing potentially freed structures
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 25 Apr 2017 10:27:08 +0000 (15:57 +0530)
committerEduardo Valentin <edubezval@gmail.com>
Sun, 28 May 2017 00:31:05 +0000 (17:31 -0700)
commit289d72afddf83440117c35d864bf0c6309c1d011
tree2a3db987ebd7578a074d15c1aafe8680250f3557
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6
thermal: cpu_cooling: Avoid accessing potentially freed structures

After the lock is dropped, it is possible that the cpufreq_dev gets
freed before we call get_level() and that can cause kernel to crash.

Drop the lock after we are done using the structure.

Cc: 4.2+ <stable@vger.kernel.org> # 4.2+
Fixes: 02373d7c69b4 ("thermal: cpu_cooling: fix lockdep problems in cpu_cooling")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Tested-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
drivers/thermal/cpu_cooling.c