Commit 3c47eb06 authored by Maulik Mankad's avatar Maulik Mankad Committed by Greg Kroah-Hartman

usb: gadget: composite: avoid access beyond array max length

One of the USB CV MSC tests issues Get Max LUN request with
invalid wIndex (wIndex = 65535) parameter.

Add proper handling to prevent array index out of bounds issue.
Signed-off-by: default avatarMaulik Mankad <maulik@ti.com>
Cc: David Brownell <david-b@pacbell.net>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d14fc1a7
......@@ -928,8 +928,9 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
*/
switch (ctrl->bRequestType & USB_RECIP_MASK) {
case USB_RECIP_INTERFACE:
if (cdev->config)
f = cdev->config->interface[intf];
if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES)
break;
f = cdev->config->interface[intf];
break;
case USB_RECIP_ENDPOINT:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment