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: submit/tizen_5.0/20190130.091426^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_5.0_unified;p=platform%2Fkernel%2Fu-boot.git 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 [jcsing.lee: cherry-pick from mainline to fix booting hanging] Signed-off-by: Jaechul Lee Change-Id: Icf90864b9649686dd17132af3493a5bab6c7f4e3 --- diff --git a/common/usb.c b/common/usb.c index 15e1e4c64e..aeb40ab942 100644 --- a/common/usb.c +++ b/common/usb.c @@ -440,12 +440,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;