diff options
| author | Pei Xiao <xiaopei01@kylinos.cn> | 2026-06-10 09:49:12 +0800 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-06-10 06:14:57 -0700 |
| commit | 1fb4397509bd8701d323e81ac9a97c2e24ed49eb (patch) | |
| tree | 5ce7f0c0e1b09992587517e67ca54666c003d733 /scripts/Makefile.thinlto | |
| parent | 046e6e1a023437bf80358cecba37ea58ebe89e94 (diff) | |
hwmon: (gpd-fan): fix race condition between device removal and sysfs access
Replace the manual gpd_fan_remove() callback with a devres-managed
action using devm_add_action_or_reset(). The original remove hook
resets the fan to AUTOMATIC mode, but the hwmon sysfs interface
(registered with devm_hwmon_device_register_with_info()) remains
active until after the remove callback completes. This creates a
race window where a concurrent userspace sysfs access can interleave
with the EC I/O sequence, potentially corrupting EC registers.
Using devm_add_action_or_reset() registers the reset function as a
devres action. Due to the LIFO release order of devres, the hwmon
device is unregistered (sysfs removed) before the reset action
executes, eliminating the race condition.
Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver")
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Link: https://lore.kernel.org/r/4400828422cf3a88adad4db224d9efccdb1049d2.1781055639.git.xiaopei01@kylinos.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
