]> git.hungrycats.org Git - linux/commitdiff
HID: hid-lenovo-go-s: Prevent deadlock if device removed during setup
authorDerek J. Clark <derekjohn.clark@gmail.com>
Mon, 14 Sep 2026 22:52:56 +0000 (15:52 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Nov 2026 17:10:51 +0000 (12:10 -0500)
commit 0ef3036c68979194fdee77a3a825fb94ef307a54 upstream.

hid_gos_cfg_remove() calls a mutex before canceling delayed work. That
delayed work function calls mcu_property_out(), which holds the same mutex.
Prevent deadlock my removing the mutex prior to stopping the work.
Additionally, since cancel_delayed_work has the potential to re-arm,
switch to disable_delayed_work.

Fixes: a23f3497bf208c59ad ("HID: hid-lenovo-go-s: Add Lenovo Legion Go S Series HID Driver")
Cc: stable@vger.kernel.org
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-lenovo-go-s.c

index a72f7f748cb50972fb60e99b726771f43269d31d..bf4e500b8ace2fe7f4e39364f7b2ba320ee77d32 100644 (file)
@@ -1425,8 +1425,7 @@ static int hid_gos_cfg_probe(struct hid_device *hdev,
 
 static void hid_gos_cfg_remove(struct hid_device *hdev)
 {
-       guard(mutex)(&drvdata.cfg_mutex);
-       cancel_delayed_work_sync(&drvdata.gos_cfg_setup);
+       disable_delayed_work_sync(&drvdata.gos_cfg_setup);
        sysfs_remove_groups(&hdev->dev.kobj, top_level_attr_groups);
        hid_hw_close(hdev);
        hid_hw_stop(hdev);