diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2026-11-03 10:26:15 -0800 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-11-03 11:32:45 -0800 |
| commit | e6b96b76d7074ae64f0d37d880794c71d3ce277e (patch) | |
| tree | 2a5fe416f518d58ab26d135b0a3b7000842f408d /tools/perf/scripts/python | |
| parent | fe23bad2156f1d5f0df8ae4a79ee590b79efc13a (diff) | |
hwmon: (hp-wmi-sensors) Serialize alarm flag read-and-clear with state->lock
In hp_wmi_hwmon_read(), temperature and fan alarm flags (info->alarm)
are evaluated and cleared without acquiring state->lock, while only the
hwmon subsystem lock is held by the hwmon core. Meanwhile, the
asynchronous WMI event handler hp_wmi_notify() sets info->alarm under
state->lock. If hp_wmi_notify() sets info->alarm between the read and
the subsequent clear in hp_wmi_hwmon_read(), the newly reported fan
stall or critical temperature alarm is overwritten with false and
permanently lost.
The driver-local state->lock cannot be replaced with the hwmon
subsystem lock (hwmon_lock()):
- When no connected hwmon-supported sensors are present (!count), the
driver operates in debugfs-only mode without registering a hwmon
device, while debugfs attributes (fungible_show()) still require
state->lock to serialize WMI queries and sensor state updates.
- Even when sensors are connected, add_event_handler() must subscribe
to WMI events before make_chip_info() and
devm_hwmon_device_register_with_info() because visibility of alarm
and intrusion attributes depends on whether event registration
succeeded. As a result, hp_wmi_notify() can run before the hwmon
device exists during probe and after devm unregisters and frees the
hwmon device during removal.
Acquire state->lock in hp_wmi_hwmon_read() around reading and clearing
info->alarm to prevent losing WMI alarm events.
Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver")
Cc: James Seo <james@equiv.tech>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
