diff options
| author | Wolfram Sang <wsa@the-dreams.de> | 2017-10-26 22:24:15 +0200 | 
|---|---|---|
| committer | Wolfram Sang <wsa@the-dreams.de> | 2017-10-26 22:24:15 +0200 | 
| commit | 3990bedea6e96cb1f182dbeadd62215dbb9e1c85 (patch) | |
| tree | 90ac0ab8ae1d4339dc17eb42a853042ea06d6b13 /drivers/usb/core/config.c | |
| parent | 631de7a4603439eaa1d7a2a1a7b5b49edcd87f67 (diff) | |
| parent | 3997fb74846f35d0364c5e88e54bc9b166d5a1bc (diff) | |
Merge branch 'i2c-mux/for-next' of https://github.com/peda-r/i2c-mux into i2c/for-4.15
This cycle has been real quiet for me. There's only the one trivial
patch that somewhat simplifies DT parsing in the i2c-mux-reg driver.
Diffstat (limited to 'drivers/usb/core/config.c')
| -rw-r--r-- | drivers/usb/core/config.c | 16 | 
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 4be52c602e9b..68b54bd88d1e 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -643,15 +643,23 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx,  		} else if (header->bDescriptorType ==  				USB_DT_INTERFACE_ASSOCIATION) { +			struct usb_interface_assoc_descriptor *d; + +			d = (struct usb_interface_assoc_descriptor *)header; +			if (d->bLength < USB_DT_INTERFACE_ASSOCIATION_SIZE) { +				dev_warn(ddev, +					 "config %d has an invalid interface association descriptor of length %d, skipping\n", +					 cfgno, d->bLength); +				continue; +			} +  			if (iad_num == USB_MAXIADS) {  				dev_warn(ddev, "found more Interface "  					       "Association Descriptors "  					       "than allocated for in "  					       "configuration %d\n", cfgno);  			} else { -				config->intf_assoc[iad_num] = -					(struct usb_interface_assoc_descriptor -					*)header; +				config->intf_assoc[iad_num] = d;  				iad_num++;  			} @@ -852,7 +860,7 @@ int usb_get_configuration(struct usb_device *dev)  		}  		if (dev->quirks & USB_QUIRK_DELAY_INIT) -			msleep(100); +			msleep(200);  		result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno,  		    bigbuffer, length);  | 
