OSDN Git Service

staging: ozwpan: Check error condition before creating endpoint.
authorRupesh Gujare <rupesh.gujare@atmel.com>
Thu, 22 Aug 2013 16:38:49 +0000 (17:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Aug 2013 17:15:55 +0000 (10:15 -0700)
Check if interface number is correct before creating an end point.

Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ozwpan/ozhcd.c

index 4682d78..d5a3900 100644 (file)
@@ -1247,6 +1247,8 @@ static int oz_build_endpoints_for_interface(struct usb_hcd *hcd,
        int request_heartbeat = 0;
 
        oz_dbg(ON, "interface[%d] = %p\n", if_ix, intf);
+       if (if_ix >= port->num_iface || port->iface == NULL)
+               return -ENOMEM;
        for (i = 0; i < intf->desc.bNumEndpoints; i++) {
                struct usb_host_endpoint *hep = &intf->endpoint[i];
                u8 ep_addr = hep->desc.bEndpointAddress;