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: Maulik Mankad <maulik@ti.com> Cc: David Brownell <david-b@pacbell.net> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
d14fc1a74e
commit
3c47eb06f0
1 changed files with 3 additions and 2 deletions
|
@ -928,8 +928,9 @@ unknown:
|
|||
*/
|
||||
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:
|
||||
|
|
Reference in a new issue