diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2015-03-03 12:52:04 +0300 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-03-10 23:33:33 +0300 |
commit | 232c0102e84b7fce634c8902a5fa30ca2b3342ac (patch) | |
tree | 2a5c6b96ee1a858a163befe2d7337deddc261b4a /drivers/usb/gadget/composite.c | |
parent | eac68e8f979b82d257eea0a4bbcda7b169d330bf (diff) | |
download | linux-232c0102e84b7fce634c8902a5fa30ca2b3342ac.tar.xz |
usb: gadget: composite: don't try standard handling for non-standard requests
If a non-standard request is processed and its parameters just happen
to match those of some standard request, the logic of composite_setup()
can be fooled, so don't even try any switch cases, just go to the
proper place where unknown requests are handled.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r-- | drivers/usb/gadget/composite.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 13adfd1a3f54..9fb92310fb2b 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1472,6 +1472,13 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) req->length = 0; gadget->ep0->driver_data = cdev; + /* + * Don't let non-standard requests match any of the cases below + * by accident. + */ + if ((ctrl->bRequestType & USB_TYPE_MASK) != USB_TYPE_STANDARD) + goto unknown; + switch (ctrl->bRequest) { /* we handle all standard USB descriptors */ |