]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
thermal/core: Protect sysfs accesses to thermal operations with thermal zone mutex
authorGuenter Roeck <linux@roeck-us.net>
Thu, 10 Nov 2022 15:24:58 +0000 (07:24 -0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 14 Nov 2022 18:04:37 +0000 (19:04 +0100)
commit05eeee2b51b44c7ba5f1b8e5c41362020513f163
treedb5f9529216677a28b1fc3af6f49f2eb9f483891
parentea37bec51ff442546e4a57d5cca2de9cc64a9df3
thermal/core: Protect sysfs accesses to thermal operations with thermal zone mutex

Protect access to thermal operations against thermal zone removal by
acquiring the thermal zone device mutex. After acquiring the mutex, check
if the thermal zone device is registered and abort the operation if not.

With this change, we can call __thermal_zone_device_update() instead of
thermal_zone_device_update() from trip_point_temp_store() and from
emul_temp_store(). Similar, we can call __thermal_zone_set_trips() instead
of thermal_zone_set_trips() from trip_point_hyst_store().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/thermal_core.c
drivers/thermal/thermal_core.h
drivers/thermal/thermal_sysfs.c