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)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:22:04 +0000 (17:22 +0900)
commitc761a567ab0a9c91d7163000a7db599adb143f7f
treedf4344d58bf98e1a8a94772b54e2722733523a95
parent4cbb225d48b6fe1e5a0889d70826a16c49b01462
thermal: cpu_cooling: Avoid accessing potentially freed structures

commit 289d72afddf83440117c35d864bf0c6309c1d011 upstream.

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.

Resolved migration conflicts from kernel 4.9 to 4.14.
- allowed_cpus -> policy->related_cpus

Change-Id: Ib7f00f738b761e291d01abbd2bf9b5745ad404e8
Signed-off-by: Eunseok Choi <es10.choi@samsung.com>
drivers/thermal/cpu_cooling.c