Skip to contentSkip to conversation

fix lockup of hid on reset

PATCH Applied Oliver Neukum 2 participants 2 messages Mar 22, 2009 – Mar 25, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix lockup of hid on reset

This fixes a use of flush_scheduled_work() in USB HID's reset logic that can deadlock. It's against the next tree.

Regards
Oliver

drivers/hid/usbhid/hid-core.c +1 -1
index bc017cd..4306cb1 100644
@@ -1210,7 +1210,6 @@ static void hid_cease_io(struct usbhid_device *usbhid)
 	usb_kill_urb(usbhid->urbin);
 	usb_kill_urb(usbhid->urbctrl);
 	usb_kill_urb(usbhid->urbout);
-	flush_scheduled_work();
 }
 
 /* Treat USB reset pretty much the same as suspend/resume */
@@ -1222,6 +1221,7 @@ static int hid_pre_reset(struct usb_interface *intf)
 	spin_lock_irq(&usbhid->lock);
 	set_bit(HID_RESET_PENDING, &usbhid->iofl);
 	spin_unlock_irq(&usbhid->lock);
+	cancel_work_sync(&usbhid->restart_work);
 	hid_cease_io(usbhid);
 
 	return 0;

Applied
#1 lore raw
Quoted 20 lines · Oliver Neukum

This fixes a use of flush_scheduled_work() in USB HID's reset logic that can deadlock. It's against the next tree.

Regards
Oliver

drivers/hid/usbhid/hid-core.c +0 -1
index bc017cd..4306cb1 100644
@@ -1210,7 +1210,6 @@ static void hid_cease_io(struct usbhid_device *usbhid)
 	usb_kill_urb(usbhid->urbin);
 	usb_kill_urb(usbhid->urbctrl);
 	usb_kill_urb(usbhid->urbout);
-	flush_scheduled_work();
 }
 
 /* Treat USB reset pretty much the same as suspend/resume */

drivers/hid/usbhid/hid-core.c static int hid_pre_reset(struct usb_interface *intf) · line 1227

Quoted 7 lines
drivers/hid/usbhid/hid-core.c +1 -0
@@ -1222,6 +1221,7 @@ static int hid_pre_reset(struct usb_interface *intf)
 	spin_lock_irq(&usbhid->lock);
 	set_bit(HID_RESET_PENDING, &usbhid->iofl);
 	spin_unlock_irq(&usbhid->lock);
+	cancel_work_sync(&usbhid->restart_work);
 	hid_cease_io(usbhid);
 
 	return 0;

Applied to autosuspend branch, thanks a lot Oliver.

Signature · 2 lines
Jiri Kosina
SUSE Labs