diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2017-09-18 06:40:40 -0700 |
---|---|---|
committer | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2017-10-02 11:20:55 +0200 |
commit | bfe683ced370c88a176f3889caa93048130da00c (patch) | |
tree | 0476db4ca2b78eece58f5f69853eab38ceeac633 | |
parent | 6e6ff87c8867cd41740bde66aeb4318b942d89fc (diff) |
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 <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
-rw-r--r-- | common/usb.c | 5 |
1 files changed, 3 insertions, 2 deletions
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; |