HID: wacom: fix crash in wacom_aes_battery_handler()
authorThomas Zeitlhofer <thomas.zeitlhofer+lkml@ze-it.at>
Mon, 19 May 2025 08:54:46 +0000 (10:54 +0200)
committerJiri Kosina <jkosina@suse.com>
Tue, 10 Jun 2025 22:27:10 +0000 (00:27 +0200)
Commit fd2a9b29dc9c ("HID: wacom: Remove AES power_supply after extended
inactivity") introduced wacom_aes_battery_handler() which is scheduled
as a delayed work (aes_battery_work).

In wacom_remove(), aes_battery_work is not canceled. Consequently, if
the device is removed while aes_battery_work is still pending, then hard
crashes or "Oops: general protection fault..." are experienced when
wacom_aes_battery_handler() is finally called. E.g., this happens with
built-in USB devices after resume from hibernate when aes_battery_work
was still pending at the time of hibernation.

So, take care to cancel aes_battery_work in wacom_remove().

Fixes: fd2a9b29dc9c ("HID: wacom: Remove AES power_supply after extended inactivity")
Signed-off-by: Thomas Zeitlhofer <thomas.zeitlhofer+lkml@ze-it.at>
Acked-by: Ping Cheng <ping.cheng@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/wacom_sys.c

index 1257131b1e34242efbc0d5a0851505b7b2b7231f..9a57504e51a19cd9ec99fbdb325887bd23f4a3f0 100644 (file)
@@ -2905,6 +2905,7 @@ static void wacom_remove(struct hid_device *hdev)
        hid_hw_stop(hdev);
 
        cancel_delayed_work_sync(&wacom->init_work);
+       cancel_delayed_work_sync(&wacom->aes_battery_work);
        cancel_work_sync(&wacom->wireless_work);
        cancel_work_sync(&wacom->battery_work);
        cancel_work_sync(&wacom->remote_work);