提交 ea37bec5 编写于 作者: G Guenter Roeck 提交者: Rafael J. Wysocki

thermal/core: Protect hwmon accesses to thermal operations with thermal zone mutex

In preparation to protecting access to thermal operations against thermal
zone device removal, protect hwmon accesses to thermal zone operations
with the thermal zone mutex. After acquiring the mutex, ensure that the
thermal zone device is registered before proceeding.
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 1c439dec
...@@ -77,7 +77,15 @@ temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf) ...@@ -77,7 +77,15 @@ temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf)
int temperature; int temperature;
int ret; int ret;
mutex_lock(&tz->lock);
if (device_is_registered(&tz->device))
ret = tz->ops->get_crit_temp(tz, &temperature); ret = tz->ops->get_crit_temp(tz, &temperature);
else
ret = -ENODEV;
mutex_unlock(&tz->lock);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册