Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356557
b: refs/heads/master
c: 4d769de
h: refs/heads/master
i:
  356555: f645f6c
v: v3
  • Loading branch information
Ming Lei authored and Linus Torvalds committed Feb 24, 2013
1 parent 2da70cd commit ab14766
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: db88175f41a29c1ffff1a6938a7969d206a47326
refs/heads/master: 4d769def244806562de1baa3acb39726131fbe6a
13 changes: 13 additions & 0 deletions trunk/drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -5177,6 +5177,7 @@ int usb_reset_device(struct usb_device *udev)
{
int ret;
int i;
unsigned int noio_flag;
struct usb_host_config *config = udev->actconfig;

if (udev->state == USB_STATE_NOTATTACHED ||
Expand All @@ -5186,6 +5187,17 @@ int usb_reset_device(struct usb_device *udev)
return -EINVAL;
}

/*
* Don't allocate memory with GFP_KERNEL in current
* context to avoid possible deadlock if usb mass
* storage interface or usbnet interface(iSCSI case)
* is included in current configuration. The easist
* approach is to do it for every device reset,
* because the device 'memalloc_noio' flag may have
* not been set before reseting the usb device.
*/
noio_flag = memalloc_noio_save();

/* Prevent autosuspend during the reset */
usb_autoresume_device(udev);

Expand Down Expand Up @@ -5230,6 +5242,7 @@ int usb_reset_device(struct usb_device *udev)
}

usb_autosuspend_device(udev);
memalloc_noio_restore(noio_flag);
return ret;
}
EXPORT_SYMBOL_GPL(usb_reset_device);
Expand Down

0 comments on commit ab14766

Please sign in to comment.