diff options
| author | Fan Wu <fanwu01@zju.edu.cn> | 2026-08-19 03:33:17 +0000 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-09-07 07:22:19 -0700 |
| commit | a2471ed17b0e6ff7bfb6b2ea8e6e5b04c309d293 (patch) | |
| tree | e02045897bd61681b82efd6b9542b4e91ab84081 /scripts/basic | |
| parent | 9607c245ca6674955e5e43e3606db410ae9e0b90 (diff) | |
| download | linux-a2471ed17b0e6ff7bfb6b2ea8e6e5b04c309d293.tar.gz linux-a2471ed17b0e6ff7bfb6b2ea8e6e5b04c309d293.zip | |
hwmon: (gpio-fan) Fix use-after-free in alarm work
fan_alarm_irq_handler() queues fan_data->alarm_work, but nothing
cancels it. fan_alarm_notify() dereferences fan_data and its hwmon
device. On unbind, devres frees the interrupt, which only waits for
the handler itself, and then releases the hwmon device and fan_data,
so a pending fan_alarm_notify() can run after those frees.
Replace INIT_WORK() with devm_work_autocancel(), registered before
devm_request_irq(). The devres cleanup then frees the interrupt
first, so no new work can be queued, and cancels the work while
fan_data and the hwmon device are still alive.
This issue was found by an in-house static analysis tool.
Fixes: d6fe1360f42e ("hwmon: add generic GPIO fan driver")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5.6
Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
Link: https://patch.msgid.link/20260819033317.446191-1-fanwu01@zju.edu.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
