summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-11-08 16:37:26 +0100
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2014-03-04 15:38:15 -0800
commit7a7b562d08ad6db98d6c8ec634620a11aaf8921a (patch)
treead6372d80cd8c356d25fb0a617b496e360840493 /drivers/usb/core/hub.c
parentf7920884eb640bc642f3b4e56f5237d30a080eda (diff)
downloadlinux-7a7b562d08ad6db98d6c8ec634620a11aaf8921a.tar.gz
linux-7a7b562d08ad6db98d6c8ec634620a11aaf8921a.tar.bz2
linux-7a7b562d08ad6db98d6c8ec634620a11aaf8921a.zip
usb: Clear host_endpoint->streams when implicitly freeing streams
If streams are still allocated on device-reset or set-interface then the hcd code implictly frees the streams. Clear host_endpoint->streams in this case so that if a driver later tries to re-allocate them it won't run afoul of the device already having streams check in usb_alloc_streams(). Note normally streams still being allocated at reset / set-intf would be a driver bug, but this can happen without it being a driver bug on reset-resume. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r--drivers/usb/core/hub.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 763c3134dd78..4f7629d1ba6a 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -5131,7 +5131,7 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
struct usb_device_descriptor descriptor = udev->descriptor;
struct usb_host_bos *bos;
- int i, ret = 0;
+ int i, j, ret = 0;
int port1 = udev->portnum;
if (udev->state == USB_STATE_NOTATTACHED ||
@@ -5257,6 +5257,9 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
ret);
goto re_enumerate;
}
+ /* Resetting also frees any allocated streams */
+ for (j = 0; j < intf->cur_altsetting->desc.bNumEndpoints; j++)
+ intf->cur_altsetting->endpoint[j].streams = 0;
}
done: