mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 02:50:43 +00:00
thermal: lock the thermal zone when switching governors
Currently, userspace can request a governor change while the governor itself is running. Grab the thermal zone lock when changing the governor to prevent this race. Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
This commit is contained in:
parent
84ffe3ecc2
commit
b6cc772f64
1 changed files with 2 additions and 0 deletions
|
@ -757,6 +757,7 @@ policy_store(struct device *dev, struct device_attribute *attr,
|
|||
snprintf(name, sizeof(name), "%s", buf);
|
||||
|
||||
mutex_lock(&thermal_governor_lock);
|
||||
mutex_lock(&tz->lock);
|
||||
|
||||
gov = __find_governor(strim(name));
|
||||
if (!gov)
|
||||
|
@ -766,6 +767,7 @@ policy_store(struct device *dev, struct device_attribute *attr,
|
|||
ret = count;
|
||||
|
||||
exit:
|
||||
mutex_unlock(&tz->lock);
|
||||
mutex_unlock(&thermal_governor_lock);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue