diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2026-11-15 16:26:32 -0800 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-11-15 18:43:26 -0800 |
| commit | f17d77541c909b7c03fa29095d45f23a79699879 (patch) | |
| tree | df01116123878588dd194c4c7ae69319b289218d /rust/kernel/alloc/allocator | |
| parent | d4f7d626cc1a966dca930a5ba07e8c4739adceb0 (diff) | |
hwmon: Use per-device lockdep keys
Currently, mutex_init(&hwdev->lock) in __hwmon_device_register() assigns
a single static lockdep key to all hardware monitoring device locks. If
one hardware monitoring device accesses another hardware monitoring
device (for example, pwm-fan controlling a PWM output provided by
adt7470), lockdep sees two instances of the same lock class acquired in
sequence and reports a false-positive recursive locking warning.
Give each struct hwmon_device its own dynamic struct lock_class_key,
registered via lockdep_register_key() and initialized with
mutex_init_with_key() before any error path that calls
hwmon_dev_release(), and cleaned up with mutex_destroy() and
lockdep_unregister_key() in hwmon_dev_release(). This allows nested
locking across distinct hwmon devices while preserving full lockdep
deadlock and self-recursion detection.
Fixes: 3ad2a7b9b15d ("hwmon: Serialize accesses in hwmon core")
Cc: stable@vger.kernel.org
Cc: Davíð Steinn Geirsson <david@dsg.is>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions
