diff options
author | Oliver Neukum <oliver@neukum.org> | 2010-01-12 06:32:50 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-01-20 18:24:34 -0500 |
commit | acbe2febe71abb2360b008e9ab3ee5c44169f78c (patch) | |
tree | 2952e2da8f32b918aaa27fd8ac00e04daa7787af | |
parent | a91b593edd4b3e8aa91f671b763b27b8119eb49d (diff) |
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.
Signed-off-by: Oliver Neukum <oliver@neukum.org>
Cc: stable <stable@kernel.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/core/devices.c | 2 | ||||
-rw-r--r-- | drivers/usb/core/message.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index 96f11715cd26..355dffcc23b0 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -494,7 +494,7 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, | |||
494 | return 0; | 494 | return 0; |
495 | /* allocate 2^1 pages = 8K (on i386); | 495 | /* allocate 2^1 pages = 8K (on i386); |
496 | * should be more than enough for one device */ | 496 | * should be more than enough for one device */ |
497 | pages_start = (char *)__get_free_pages(GFP_KERNEL, 1); | 497 | pages_start = (char *)__get_free_pages(GFP_NOIO, 1); |
498 | if (!pages_start) | 498 | if (!pages_start) |
499 | return -ENOMEM; | 499 | return -ENOMEM; |
500 | 500 | ||
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 1b994846e8e0..9bc95fec793f 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -906,11 +906,11 @@ char *usb_cache_string(struct usb_device *udev, int index) | |||
906 | if (index <= 0) | 906 | if (index <= 0) |
907 | return NULL; | 907 | return NULL; |
908 | 908 | ||
909 | buf = kmalloc(MAX_USB_STRING_SIZE, GFP_KERNEL); | 909 | buf = kmalloc(MAX_USB_STRING_SIZE, GFP_NOIO); |
910 | if (buf) { | 910 | if (buf) { |
911 | len = usb_string(udev, index, buf, MAX_USB_STRING_SIZE); | 911 | len = usb_string(udev, index, buf, MAX_USB_STRING_SIZE); |
912 | if (len > 0) { | 912 | if (len > 0) { |
913 | smallbuf = kmalloc(++len, GFP_KERNEL); | 913 | smallbuf = kmalloc(++len, GFP_NOIO); |
914 | if (!smallbuf) | 914 | if (!smallbuf) |
915 | return buf; | 915 | return buf; |
916 | memcpy(smallbuf, buf, len); | 916 | memcpy(smallbuf, buf, len); |
@@ -1731,7 +1731,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) | |||
1731 | if (cp) { | 1731 | if (cp) { |
1732 | nintf = cp->desc.bNumInterfaces; | 1732 | nintf = cp->desc.bNumInterfaces; |
1733 | new_interfaces = kmalloc(nintf * sizeof(*new_interfaces), | 1733 | new_interfaces = kmalloc(nintf * sizeof(*new_interfaces), |
1734 | GFP_KERNEL); | 1734 | GFP_NOIO); |
1735 | if (!new_interfaces) { | 1735 | if (!new_interfaces) { |
1736 | dev_err(&dev->dev, "Out of memory\n"); | 1736 | dev_err(&dev->dev, "Out of memory\n"); |
1737 | return -ENOMEM; | 1737 | return -ENOMEM; |
@@ -1740,7 +1740,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) | |||
1740 | for (; n < nintf; ++n) { | 1740 | for (; n < nintf; ++n) { |
1741 | new_interfaces[n] = kzalloc( | 1741 | new_interfaces[n] = kzalloc( |
1742 | sizeof(struct usb_interface), | 1742 | sizeof(struct usb_interface), |
1743 | GFP_KERNEL); | 1743 | GFP_NOIO); |
1744 | if (!new_interfaces[n]) { | 1744 | if (!new_interfaces[n]) { |
1745 | dev_err(&dev->dev, "Out of memory\n"); | 1745 | dev_err(&dev->dev, "Out of memory\n"); |
1746 | ret = -ENOMEM; | 1746 | ret = -ENOMEM; |