linux/drivers/hid/usbhid
Alan Stern 972e6a993f HID: usbhid: fix inconsistent reset/resume/reset-resume behavior
The usbhid driver has inconsistently duplicated code in its post-reset,
resume, and reset-resume pathways.

	reset-resume doesn't check HID_STARTED before trying to
	restart the I/O queues.

	resume fails to clear the HID_SUSPENDED flag if HID_STARTED
	isn't set.

	resume calls usbhid_restart_queues() with usbhid->lock held
	and the others call it without holding the lock.

The first item in particular causes a problem following a reset-resume
if the driver hasn't started up its I/O.  URB submission fails because
usbhid->urbin is NULL, and this triggers an unending reset-retry loop.

This patch fixes the problem by creating a new subroutine,
hid_restart_io(), to carry out all the common activities.  It also
adds some checks that were missing in the original code:

	After a reset, there's no need to clear any halted endpoints.

	After a resume, if a reset is pending there's no need to
	restart any I/O until the reset is finished.

	After a resume, if the interrupt-IN endpoint is halted there's
	no need to submit the input URB until the halt has been
	cleared.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Daniel Fraga <fragabr@gmail.com>
Tested-by: Daniel Fraga <fragabr@gmail.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-03-24 15:26:20 +01:00
..
hid-core.c HID: usbhid: fix inconsistent reset/resume/reset-resume behavior 2016-03-24 15:26:20 +01:00
hid-pidff.c HID: pidff: effect can't be NULL 2015-03-27 16:03:26 +01:00
hid-quirks.c HID: usbhid: enable NO_INIT_REPORTS quirk for Semico USB Keykoard2 2016-03-10 18:20:24 +01:00
hiddev.c HID: use hid_hw_wait() instead of direct call to usbhid 2013-02-25 13:26:41 +01:00
Kconfig HID: Fix the generic Kconfig options 2012-06-25 17:25:00 +02:00
Makefile HID: Use Kbuild idiom in Makefiles 2015-01-21 22:23:20 +01:00
usbhid.h HID: usbhid: use to_usb_device 2015-12-28 13:13:20 +01:00
usbkbd.c HID: usbkbd: fix inconsistent debugging output 2013-11-19 11:32:04 +01:00
usbmouse.c USB: usbmouse.c: remove err() usage 2012-04-25 14:48:20 -07:00