]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: gadget: rndis: don't test against req->length
authorFelipe Balbi <balbi@ti.com>
Fri, 13 May 2011 13:53:48 +0000 (16:53 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 23 Jun 2011 22:24:03 +0000 (15:24 -0700)
commit 472b91274a6c6857877b5caddb875dcb5ecdfcb8 upstream.

composite.c always sets req->length to zero
and expects function driver's setup handlers
to return the amount of bytes to be used
on req->length. If we test against req->length
w_length will always be greater than req->length
thus making us always stall that particular
SEND_ENCAPSULATED_COMMAND request.

Tested against a Windows XP SP3.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/f_rndis.c

index c9966cc07d3a87576ab749286650e5c5ab3e6b0f..5201374ae13cdae8d5328aa2815cc6d8e133782c 100644 (file)
@@ -400,8 +400,7 @@ rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
         */
        case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8)
                        | USB_CDC_SEND_ENCAPSULATED_COMMAND:
-               if (w_length > req->length || w_value
-                               || w_index != rndis->ctrl_id)
+               if (w_value || w_index != rndis->ctrl_id)
                        goto invalid;
                /* read the request; process it later */
                value = w_length;