Skip to contentSkip to conversation

HID: hid-steam: Make sure rumble work is canceled on removal

PATCH Applied Vicki Pfau 2 participants 2 messages Dec 26, 2024 – Jan 9, 2025

Subsystems (2)
lore
Share & tools
lore

Vicki Pfau

author maintainer
#0 lore raw

PATCH 1/1 HID: hid-steam: Make sure rumble work is canceled on removal

When a force feedback command is sent from userspace, work is scheduled to pass this data to the controller without blocking userspace itself. However, in theory, this work might not be properly canceled if the controller is removed at the exact right time. This patch ensures the work is properly canceled when the device is removed.

---
 drivers/hid/hid-steam.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hid/hid-steam.c +1 -0
index 6439913372a8..af38fc8eb34f 100644
@@ -1306,6 +1306,7 @@ static void steam_remove(struct hid_device *hdev)
 
 	cancel_delayed_work_sync(&steam->mode_switch);
 	cancel_work_sync(&steam->work_connect);
+	cancel_work_sync(&steam->rumble_work);
 	hid_destroy_device(steam->client_hdev);
 	steam->client_hdev = NULL;
 	steam->client_opened = 0;
Signature · 1 line
2.47.1
maintainer Applied
#1 lore raw
Quoted 16 lines · Vicki Pfau

When a force feedback command is sent from userspace, work is scheduled to pass this data to the controller without blocking userspace itself. However, in theory, this work might not be properly canceled if the controller is removed at the exact right time. This patch ensures the work is properly canceled when the device is removed.

---
 drivers/hid/hid-steam.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hid/hid-steam.c +0 -0
index 6439913372a8..af38fc8eb34f 100644

drivers/hid/hid-steam.c static void steam_remove(struct hid_device *hdev) · line 1312

Quoted 7 lines
drivers/hid/hid-steam.c +1 -0
@@ -1306,6 +1306,7 @@ static void steam_remove(struct hid_device *hdev)
 
 	cancel_delayed_work_sync(&steam->mode_switch);
 	cancel_work_sync(&steam->work_connect);
+	cancel_work_sync(&steam->rumble_work);
 	hid_destroy_device(steam->client_hdev);
 	steam->client_hdev = NULL;
 	steam->client_opened = 0;

Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs