Re: [PATCH] usbhid: use GFP_NOIO in reset code path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 10 October 2012 14:56:04 Jiri Kosina wrote:
> On Wed, 10 Oct 2012, Oliver Neukum wrote:
> 
> > For mice with card readers the HID driver can deadlock as its 
> > post_reset() method allocates memory. GFP_NOIO must be used in a block 
> > layer error handler, which usbhid can be indirectly part of.
> 
> Hi Oliver,
> 
> umm ... could you please elaborate how this can actually happen?
> 
> I guess the USB mouse has a hub inside, and the card reader is connected 
> to that HUB, right? (or perhaps different USB interface?).
> 
> In any case, how does HID get bound to the card reader interface? What am 
> I missing?

Hi,

HID isn't bound to the to the card reader interface. However if the card reader
requests a reset, all the interfaces are reset. Before the reset is done pre_reset()
is called for all interfaces and before usb_reset_device() returns post_reset()
must run for all interfaces.
The following sequence happens:

SCSI error -> bus_reset() -> usb storage: usb_reset_device() -> reset going on
-> usbhid: post_reset() -> kmalloc(..., GFP_KERNEL) -> page is paged out
-> sd waits for reset to finish --> DEADLOCK

So this can happen only if there is no hub. But Alan Stern reported having such
a device.

I audited a patch from Ming Lei which introduces the same problem for usbnet.
So I checked usbhid. You need to be unlucky, but it may happen, so here's the
patch.

	Regards
		Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux