On Tue, 12 Jan 2010, Oliver Neukum wrote: > From 1033efbabe95fa88cf439f756333a8b0a63da751 Mon Sep 17 00:00:00 2001 > From: Oliver Neukum <oliver@xxxxxxxxxx> > Date: Tue, 12 Jan 2010 12:19:23 +0100 > Subject: [PATCH] usb:Don't use GFP_KERNEL while we cannot reset a storage device > > Memory allocations with GFP_KERNEL can cause IO to a storage > device which can fail resulting in a need to reset the device. > Therefore GFP_KERNEL cannot be safely used between usb_lock_device() > and usb_unlock_device(). Replace by GFP_NOIO. ... > @@ -1731,7 +1731,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) > if (cp) { > nintf = cp->desc.bNumInterfaces; > new_interfaces = kmalloc(nintf * sizeof(*new_interfaces), > - GFP_KERNEL); > + GFP_NOIO); > if (!new_interfaces) { > dev_err(&dev->dev, "Out of memory\n"); > return -ENOMEM; > @@ -1740,7 +1740,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) > for (; n < nintf; ++n) { > new_interfaces[n] = kzalloc( > sizeof(struct usb_interface), > - GFP_KERNEL); > + GFP_NOIO); > if (!new_interfaces[n]) { > dev_err(&dev->dev, "Out of memory\n"); > ret = -ENOMEM; > This last two changes seem unnecessary. If you're in usb_set_configuration() then usb_storage (or anything else) either isn't bound or is about to be unbound from the device's interfaces. Hence you don't have to be concerned about error recovery. Alan Stern -- 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