提交 b6cc772f 编写于 作者: J Javi Merino 提交者: Zhang Rui

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: NJavi Merino <javi.merino@arm.com>
Signed-off-by: NZhang Rui <rui.zhang@intel.com>
上级 84ffe3ec
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册