Patch "thermal: cpu_cooling: Avoid accessing potentially freed structures" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
thermal: cpu_cooling: Avoid accessing potentially freed structures
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
thermal-cpu_cooling-avoid-accessing-potentially-freed-structures.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
289d72afddf83440117c35d864bf0c6309c1d011Mon Sep 17 00:00:00 2001
From: Viresh Kumar <[email protected]>
Date: Tue, 25 Apr 2017 15:57:08 +0530
Subject: thermal: cpu_cooling: Avoid accessing potentially freed structures
From: Viresh Kumar <[email protected]>
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.
--- drivers/thermal/cpu_cooling.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/thermal/cpu_cooling.c +3 -1
@@ -191,8 +191,10 @@ unsigned long cpufreq_cooling_get_level(mutex_lock (&cooling_list_lock);list_for_each_entry (cpufreq_dev, &cpufreq_dev_list, node) {if (cpumask_test_cpu (cpu, &cpufreq_dev->allowed_cpus)) { +unsigned long level =get_level (cpufreq_dev, freq); +mutex_unlock (&cooling_list_lock); -return get_level (cpufreq_dev, freq); +return level; } }mutex_unlock (&cooling_list_lock);
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/thermal-cpu_cooling-avoid-accessing-potentially-freed-structures.patch