[PATCH 2/2] HID: winwing: initialize the lights_lock mutex
From: René Onier
Date: Wed Sep 30 2026 - 17:01:39 EST
winwing_led_write() takes data->lights_lock, but that mutex is never
initialized. winwing_probe() allocates the driver data with
devm_kzalloc() and only initializes the work item, so the mutex is left
zeroed.
Locking an uninitialized mutex is undefined behaviour; with
CONFIG_DEBUG_MUTEXES or lockdep enabled it is reported as soon as a LED
brightness is written, either from sysfs or by a LED trigger.
Initialize the mutex in winwing_probe(), next to the work item it is
allocated with.
Fixes: 266c990debad ("HID: Add WinWing Orion2 throttle support")
Signed-off-by: René Onier <f3nr1l@xxxxxx>
---
drivers/hid/hid-winwing.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/hid-winwing.c b/drivers/hid/hid-winwing.c
index e8030fdc14..cbfdb9c66e 100644
--- a/drivers/hid/hid-winwing.c
+++ b/drivers/hid/hid-winwing.c
@@ -374,6 +374,7 @@ static int winwing_probe(struct hid_device *hdev,
data->has_grip15 = id->driver_data;
hid_set_drvdata(hdev, data);
+ mutex_init(&data->lights_lock);
INIT_WORK(&data->rumble_work, winwing_haptic_rumble_cb);
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
--
2.55.0