Skip to content
Snippets Groups Projects
Commit 2f0eb2ac authored by Bin Meng's avatar Bin Meng Committed by Marek Vasut
Browse files

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: default avatarBin Meng <bmeng.cn@gmail.com>
parent 8a0e6d83
No related branches found
No related tags found
No related merge requests found
...@@ -437,12 +437,13 @@ static int usb_parse_config(struct usb_device *dev, ...@@ -437,12 +437,13 @@ static int usb_parse_config(struct usb_device *dev,
} }
break; break;
case USB_DT_ENDPOINT: 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", printf("ERROR: Invalid USB EP length (%d)\n",
head->bLength); head->bLength);
break; break;
} }
if (index + USB_DT_ENDPOINT_SIZE > if (index + head->bLength >
dev->config.desc.wTotalLength) { dev->config.desc.wTotalLength) {
puts("USB EP descriptor overflowed buffer!\n"); puts("USB EP descriptor overflowed buffer!\n");
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment