Commit 5969c55
platform/x86: hp-wmi: add locking for concurrent hwmon access
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>1 parent cb4daa4 commit 5969c55
1 file changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| 456 | + | |
456 | 457 | | |
457 | 458 | | |
458 | 459 | | |
| |||
2422 | 2423 | | |
2423 | 2424 | | |
2424 | 2425 | | |
| 2426 | + | |
2425 | 2427 | | |
2426 | 2428 | | |
2427 | 2429 | | |
| |||
2445 | 2447 | | |
2446 | 2448 | | |
2447 | 2449 | | |
2448 | | - | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
2449 | 2453 | | |
2450 | 2454 | | |
2451 | 2455 | | |
2452 | | - | |
| 2456 | + | |
2453 | 2457 | | |
2454 | 2458 | | |
2455 | 2459 | | |
| |||
2467 | 2471 | | |
2468 | 2472 | | |
2469 | 2473 | | |
| 2474 | + | |
2470 | 2475 | | |
2471 | 2476 | | |
2472 | 2477 | | |
| |||
2535 | 2540 | | |
2536 | 2541 | | |
2537 | 2542 | | |
| 2543 | + | |
| 2544 | + | |
2538 | 2545 | | |
2539 | 2546 | | |
2540 | 2547 | | |
| |||
2591 | 2598 | | |
2592 | 2599 | | |
2593 | 2600 | | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
2594 | 2605 | | |
2595 | 2606 | | |
2596 | 2607 | | |
| |||
0 commit comments