Commit 9e2eae9
platform/x86: hp-wmi: add locking for concurrent hwmon access
[ Upstream commit 5969c55 ]
hp_wmi_hwmon_priv.mode and .pwm are written by hp_wmi_hwmon_write() in
sysfs context and read by hp_wmi_hwmon_keep_alive_handler() in a
workqueue. A concurrent write and keep-alive expiry can observe an
inconsistent mode/pwm pair (e.g. mode=MANUAL with a stale pwm).
Add a mutex to hp_wmi_hwmon_priv protecting mode and pwm. Hold it in
hp_wmi_hwmon_write() across the field update and apply call, and in
hp_wmi_hwmon_keep_alive_handler() before calling apply.
In hp_wmi_hwmon_read(), only the pwm_enable path reads priv->mode; use
scoped_guard() there to avoid holding the lock across unrelated WMI
calls.
Fixes: c203c59 ("platform/x86: hp-wmi: implement fan keep-alive")
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Emre Cecanpunar <emreleno@gmail.com>
Link: https://patch.msgid.link/20260407142515.20683-6-emreleno@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent e9fca2b commit 9e2eae9
1 file changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| 461 | + | |
461 | 462 | | |
462 | 463 | | |
463 | 464 | | |
| |||
2427 | 2428 | | |
2428 | 2429 | | |
2429 | 2430 | | |
| 2431 | + | |
2430 | 2432 | | |
2431 | 2433 | | |
2432 | 2434 | | |
| |||
2450 | 2452 | | |
2451 | 2453 | | |
2452 | 2454 | | |
2453 | | - | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
2454 | 2458 | | |
2455 | 2459 | | |
2456 | 2460 | | |
2457 | | - | |
| 2461 | + | |
2458 | 2462 | | |
2459 | 2463 | | |
2460 | 2464 | | |
| |||
2472 | 2476 | | |
2473 | 2477 | | |
2474 | 2478 | | |
| 2479 | + | |
2475 | 2480 | | |
2476 | 2481 | | |
2477 | 2482 | | |
| |||
2540 | 2545 | | |
2541 | 2546 | | |
2542 | 2547 | | |
| 2548 | + | |
| 2549 | + | |
2543 | 2550 | | |
2544 | 2551 | | |
2545 | 2552 | | |
| |||
2596 | 2603 | | |
2597 | 2604 | | |
2598 | 2605 | | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
2599 | 2610 | | |
2600 | 2611 | | |
2601 | 2612 | | |
| |||
0 commit comments