Commit ce7b6121 authored by Paul Zimmerman's avatar Paul Zimmerman Committed by Greg Kroah-Hartman

usb: gadget: storage: check for valid USB_BULK_RESET_REQUEST wLength

The USB-IF CV compliance tester is getting stricter, and it would
be valid for it to fail a mass-storage device that accepts an
invalid USB_BULK_RESET_REQUEST request. Although it doesn't do
that yet, let's be proactive and fix that now.

Suggested by Alan Stern.
Signed-off-by: default avatarPaul Zimmerman <paulz@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent db332bc9
...@@ -624,7 +624,8 @@ static int fsg_setup(struct usb_function *f, ...@@ -624,7 +624,8 @@ static int fsg_setup(struct usb_function *f,
if (ctrl->bRequestType != if (ctrl->bRequestType !=
(USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE))
break; break;
if (w_index != fsg->interface_number || w_value != 0) if (w_index != fsg->interface_number || w_value != 0 ||
w_length != 0)
return -EDOM; return -EDOM;
/* /*
......
...@@ -859,7 +859,7 @@ static int class_setup_req(struct fsg_dev *fsg, ...@@ -859,7 +859,7 @@ static int class_setup_req(struct fsg_dev *fsg,
if (ctrl->bRequestType != (USB_DIR_OUT | if (ctrl->bRequestType != (USB_DIR_OUT |
USB_TYPE_CLASS | USB_RECIP_INTERFACE)) USB_TYPE_CLASS | USB_RECIP_INTERFACE))
break; break;
if (w_index != 0 || w_value != 0) { if (w_index != 0 || w_value != 0 || w_length != 0) {
value = -EDOM; value = -EDOM;
break; break;
} }
......
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