Commit cb4c8fe5 authored by Inaky Perez-Gonzalez's avatar Inaky Perez-Gonzalez Committed by Greg Kroah-Hartman

usb: deal with broken config descriptors

Change usb_get_configuration() so that it is more tolerant to devices
with bad configuration descriptors (it'll make it ignore
configurations that fail to load).
Signed-off-by: default avatarInaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent dfe0d3ba
...@@ -475,7 +475,9 @@ int usb_get_configuration(struct usb_device *dev) ...@@ -475,7 +475,9 @@ int usb_get_configuration(struct usb_device *dev)
if (result < 0) { if (result < 0) {
dev_err(ddev, "unable to read config index %d " dev_err(ddev, "unable to read config index %d "
"descriptor/%s\n", cfgno, "start"); "descriptor/%s\n", cfgno, "start");
goto err; dev_err(ddev, "chopping to %d config(s)\n", cfgno);
dev->descriptor.bNumConfigurations = cfgno;
break;
} else if (result < 4) { } else if (result < 4) {
dev_err(ddev, "config index %d descriptor too short " dev_err(ddev, "config index %d descriptor too short "
"(expected %i, got %i)\n", cfgno, "(expected %i, got %i)\n", cfgno,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment