diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2012-10-22 16:15:00 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-10-31 09:04:24 -0400 |
commit | e79cc615a9bb44da72c499ccfa2c9c4bbea3aa84 (patch) | |
tree | 0b860852814460a151fe7323ae1d31726adbe18f | |
parent | 391aa852a372308c216d8638e57fe8fe560558f2 (diff) |
usb: gadget: network: fix bind() error path
I think this is wrong since 72c973dd ("usb: gadget: add
usb_endpoint_descriptor to struct usb_ep"). If we fail to allocate an ep
or bail out early we shouldn't check for the descriptor which is
assigned at ep_enable() time.
Cc: Tatyana Brokhman <tlinder@codeaurora.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/gadget/f_ecm.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/f_eem.c | 5 | ||||
-rw-r--r-- | drivers/usb/gadget/f_ncm.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/f_rndis.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/f_subset.c | 4 |
5 files changed, 10 insertions, 11 deletions
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c index 789242749df5..a158740255ce 100644 --- a/drivers/usb/gadget/f_ecm.c +++ b/drivers/usb/gadget/f_ecm.c | |||
@@ -809,9 +809,9 @@ fail: | |||
809 | /* we might as well release our claims on endpoints */ | 809 | /* we might as well release our claims on endpoints */ |
810 | if (ecm->notify) | 810 | if (ecm->notify) |
811 | ecm->notify->driver_data = NULL; | 811 | ecm->notify->driver_data = NULL; |
812 | if (ecm->port.out_ep->desc) | 812 | if (ecm->port.out_ep) |
813 | ecm->port.out_ep->driver_data = NULL; | 813 | ecm->port.out_ep->driver_data = NULL; |
814 | if (ecm->port.in_ep->desc) | 814 | if (ecm->port.in_ep) |
815 | ecm->port.in_ep->driver_data = NULL; | 815 | ecm->port.in_ep->driver_data = NULL; |
816 | 816 | ||
817 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); | 817 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); |
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c index 1a7b2dd7d408..a9cf20522ffa 100644 --- a/drivers/usb/gadget/f_eem.c +++ b/drivers/usb/gadget/f_eem.c | |||
@@ -319,10 +319,9 @@ fail: | |||
319 | if (f->hs_descriptors) | 319 | if (f->hs_descriptors) |
320 | usb_free_descriptors(f->hs_descriptors); | 320 | usb_free_descriptors(f->hs_descriptors); |
321 | 321 | ||
322 | /* we might as well release our claims on endpoints */ | 322 | if (eem->port.out_ep) |
323 | if (eem->port.out_ep->desc) | ||
324 | eem->port.out_ep->driver_data = NULL; | 323 | eem->port.out_ep->driver_data = NULL; |
325 | if (eem->port.in_ep->desc) | 324 | if (eem->port.in_ep) |
326 | eem->port.in_ep->driver_data = NULL; | 325 | eem->port.in_ep->driver_data = NULL; |
327 | 326 | ||
328 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); | 327 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); |
diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c index 4f0950069a43..424fc3d1cc36 100644 --- a/drivers/usb/gadget/f_ncm.c +++ b/drivers/usb/gadget/f_ncm.c | |||
@@ -1259,9 +1259,9 @@ fail: | |||
1259 | /* we might as well release our claims on endpoints */ | 1259 | /* we might as well release our claims on endpoints */ |
1260 | if (ncm->notify) | 1260 | if (ncm->notify) |
1261 | ncm->notify->driver_data = NULL; | 1261 | ncm->notify->driver_data = NULL; |
1262 | if (ncm->port.out_ep->desc) | 1262 | if (ncm->port.out_ep) |
1263 | ncm->port.out_ep->driver_data = NULL; | 1263 | ncm->port.out_ep->driver_data = NULL; |
1264 | if (ncm->port.in_ep->desc) | 1264 | if (ncm->port.in_ep) |
1265 | ncm->port.in_ep->driver_data = NULL; | 1265 | ncm->port.in_ep->driver_data = NULL; |
1266 | 1266 | ||
1267 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); | 1267 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 61f4b13c6cf5..7c27626f0235 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -803,9 +803,9 @@ fail: | |||
803 | /* we might as well release our claims on endpoints */ | 803 | /* we might as well release our claims on endpoints */ |
804 | if (rndis->notify) | 804 | if (rndis->notify) |
805 | rndis->notify->driver_data = NULL; | 805 | rndis->notify->driver_data = NULL; |
806 | if (rndis->port.out_ep->desc) | 806 | if (rndis->port.out_ep) |
807 | rndis->port.out_ep->driver_data = NULL; | 807 | rndis->port.out_ep->driver_data = NULL; |
808 | if (rndis->port.in_ep->desc) | 808 | if (rndis->port.in_ep) |
809 | rndis->port.in_ep->driver_data = NULL; | 809 | rndis->port.in_ep->driver_data = NULL; |
810 | 810 | ||
811 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); | 811 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); |
diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c index 4060c0bd9785..deb437c3b53e 100644 --- a/drivers/usb/gadget/f_subset.c +++ b/drivers/usb/gadget/f_subset.c | |||
@@ -370,9 +370,9 @@ fail: | |||
370 | usb_free_descriptors(f->hs_descriptors); | 370 | usb_free_descriptors(f->hs_descriptors); |
371 | 371 | ||
372 | /* we might as well release our claims on endpoints */ | 372 | /* we might as well release our claims on endpoints */ |
373 | if (geth->port.out_ep->desc) | 373 | if (geth->port.out_ep) |
374 | geth->port.out_ep->driver_data = NULL; | 374 | geth->port.out_ep->driver_data = NULL; |
375 | if (geth->port.in_ep->desc) | 375 | if (geth->port.in_ep) |
376 | geth->port.in_ep->driver_data = NULL; | 376 | geth->port.in_ep->driver_data = NULL; |
377 | 377 | ||
378 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); | 378 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); |