summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ozwpan/ozhcd.c
diff options
context:
space:
mode:
authorRupesh Gujare2013-08-22 18:38:49 +0200
committerGreg Kroah-Hartman2013-08-22 19:15:55 +0200
commitd236dc11a17e8fa29c1b4e0ecc8cf5b9bcc7fcf5 (patch)
tree1e270d507a4070f8620bfafb6ca017046e733219 /drivers/staging/ozwpan/ozhcd.c
parentstaging: ozwpan: Fix crash for race condition. (diff)
downloadkernel-qcow2-linux-d236dc11a17e8fa29c1b4e0ecc8cf5b9bcc7fcf5.tar.gz
kernel-qcow2-linux-d236dc11a17e8fa29c1b4e0ecc8cf5b9bcc7fcf5.tar.xz
kernel-qcow2-linux-d236dc11a17e8fa29c1b4e0ecc8cf5b9bcc7fcf5.zip
staging: ozwpan: Check error condition before creating endpoint.
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>
Diffstat (limited to 'drivers/staging/ozwpan/ozhcd.c')
-rw-r--r--drivers/staging/ozwpan/ozhcd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index 4682d782abe7..d5a3900d4181 100644
--- a/drivers/staging/ozwpan/ozhcd.c
+++ b/drivers/staging/ozwpan/ozhcd.c
@@ -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;