From: Bin Meng Date: Mon, 18 Sep 2017 13:40:40 +0000 (-0700) Subject: usb: Handle audio extension endpoint descriptor in usb_parse_config() X-Git-Tag: v2017.11-rc1~2^2~12 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2f0eb2ac4b84f94e2f7de6e4ec9b63ce07cfec7a;p=u-boot usb: Handle audio extension endpoint descriptor in usb_parse_config() Normal endpoint descriptor size is 7, but for audio extension it is 9. Handle that correctly when parsing endpoint descriptor. Signed-off-by: Bin Meng --- diff --git a/common/usb.c b/common/usb.c index 0904259757..6cb92ef4f5 100644 --- a/common/usb.c +++ b/common/usb.c @@ -437,12 +437,13 @@ static int usb_parse_config(struct usb_device *dev, } break; case USB_DT_ENDPOINT: - if (head->bLength != USB_DT_ENDPOINT_SIZE) { + if (head->bLength != USB_DT_ENDPOINT_SIZE && + head->bLength != USB_DT_ENDPOINT_AUDIO_SIZE) { printf("ERROR: Invalid USB EP length (%d)\n", head->bLength); break; } - if (index + USB_DT_ENDPOINT_SIZE > + if (index + head->bLength > dev->config.desc.wTotalLength) { puts("USB EP descriptor overflowed buffer!\n"); break;