aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/usb.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-12-09 13:18:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-09 13:18:24 -0500
commit50a5528a4b19b7324f0796ea2fedf32530a11ff8 (patch)
tree185a023ee6c30da3744ac3ddb610f88e432fdc65 /drivers/usb/core/usb.c
parentbc4caf186fb691ad56adbe578d356a262f3a7d10 (diff)
parent3caad34eab57e622dad48086af7f89c19001664e (diff)
Merge tag 'usb-4.20-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB fixes for 4.20-rc6 The "largest" here are some xhci fixes for reported issues. Also here is a USB core fix, some quirk additions, and a usb-serial fix which required the export of one of the tty layer's functions to prevent code duplication. The tty maintainer agreed with this change. All of these have been in linux-next with no reported issues" * tag 'usb-4.20-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: xhci: Prevent U1/U2 link pm states if exit latency is too long xhci: workaround CSS timeout on AMD SNPS 3.0 xHC USB: check usb_get_extra_descriptor for proper size USB: serial: console: fix reported terminal settings usb: quirk: add no-LPM quirk on SanDisk Ultra Flair device USB: Fix invalid-free bug in port_over_current_notify() usb: appledisplay: Add 27" Apple Cinema Display
Diffstat (limited to 'drivers/usb/core/usb.c')
-rw-r--r--drivers/usb/core/usb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 79d8bd7a612e..4ebfbd737905 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -832,14 +832,14 @@ EXPORT_SYMBOL_GPL(usb_get_current_frame_number);
832 */ 832 */
833 833
834int __usb_get_extra_descriptor(char *buffer, unsigned size, 834int __usb_get_extra_descriptor(char *buffer, unsigned size,
835 unsigned char type, void **ptr) 835 unsigned char type, void **ptr, size_t minsize)
836{ 836{
837 struct usb_descriptor_header *header; 837 struct usb_descriptor_header *header;
838 838
839 while (size >= sizeof(struct usb_descriptor_header)) { 839 while (size >= sizeof(struct usb_descriptor_header)) {
840 header = (struct usb_descriptor_header *)buffer; 840 header = (struct usb_descriptor_header *)buffer;
841 841
842 if (header->bLength < 2) { 842 if (header->bLength < 2 || header->bLength > size) {
843 printk(KERN_ERR 843 printk(KERN_ERR
844 "%s: bogus descriptor, type %d length %d\n", 844 "%s: bogus descriptor, type %d length %d\n",
845 usbcore_name, 845 usbcore_name,
@@ -848,7 +848,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
848 return -1; 848 return -1;
849 } 849 }
850 850
851 if (header->bDescriptorType == type) { 851 if (header->bDescriptorType == type && header->bLength >= minsize) {
852 *ptr = header; 852 *ptr = header;
853 return 0; 853 return 0;
854 } 854 }