USB: Gadget: Composite: Debug interface comparison
authorJassi Brar <jassi.brar@samsung.com>
Sun, 6 Feb 2011 08:39:17 +0000 (17:39 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 17 Feb 2011 18:41:46 +0000 (10:41 -0800)
While checking valid interface number we should compare MAX_CONFIG_INTERFACES
with the variable 'intf' (which holds the lower 8bits of w_index) rather than
'w_index'

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/composite.c

index 1ba4befe336b6b77741f163510c6e5890e7d0df6..bbbbfb70750428c00f217738ae08a10362b83906 100644 (file)
@@ -887,7 +887,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
        case USB_REQ_SET_INTERFACE:
                if (ctrl->bRequestType != USB_RECIP_INTERFACE)
                        goto unknown;
-               if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES)
+               if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
                        break;
                f = cdev->config->interface[intf];
                if (!f)
@@ -899,7 +899,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
        case USB_REQ_GET_INTERFACE:
                if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE))
                        goto unknown;
-               if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES)
+               if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
                        break;
                f = cdev->config->interface[intf];
                if (!f)
@@ -928,7 +928,7 @@ unknown:
                 */
                switch (ctrl->bRequestType & USB_RECIP_MASK) {
                case USB_RECIP_INTERFACE:
-                       if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES)
+                       if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
                                break;
                        f = cdev->config->interface[intf];
                        break;