aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorLan Tianyu <tianyu.lan@intel.com>2012-09-05 01:44:37 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-10 16:04:01 -0400
commit3a22b872e923954853cabd5a18f41da1846bccdb (patch)
tree8b528be0d99bb136c9eb2b21d97c151440c701f4 /drivers/usb/core
parentf7ac7787ad361e31a7972e2854ed8dc2eedfac3b (diff)
usb: Fail a get config when the port is powered off.
Alan Stern pointed out that a USB port could potentially get powered off when the attached USB device is in the middle of enumerating, due to race conditions: http://marc.info/?l=linux-usb&m=134130616707548&w=2 If that happens, we need to ensure the enumeration fails. If a call to usb_get_descriptor() fails for a reason other than a Stall, return an error. That should handle the case where the port is powered off. Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/config.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index f4bdd0ce8d56..7199adccf444 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -702,6 +702,8 @@ int usb_get_configuration(struct usb_device *dev)
702 if (result < 0) { 702 if (result < 0) {
703 dev_err(ddev, "unable to read config index %d " 703 dev_err(ddev, "unable to read config index %d "
704 "descriptor/%s: %d\n", cfgno, "start", result); 704 "descriptor/%s: %d\n", cfgno, "start", result);
705 if (result != -EPIPE)
706 goto err;
705 dev_err(ddev, "chopping to %d config(s)\n", cfgno); 707 dev_err(ddev, "chopping to %d config(s)\n", cfgno);
706 dev->descriptor.bNumConfigurations = cfgno; 708 dev->descriptor.bNumConfigurations = cfgno;
707 break; 709 break;