]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: gadget: network: fix bind() error path
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 22 Oct 2012 20:15:00 +0000 (22:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Jan 2013 17:18:35 +0000 (09:18 -0800)
commit e79cc615a9bb44da72c499ccfa2c9c4bbea3aa84 upstream.

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.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/f_ecm.c
drivers/usb/gadget/f_eem.c
drivers/usb/gadget/f_ncm.c
drivers/usb/gadget/f_rndis.c
drivers/usb/gadget/f_subset.c

index 95bc94f8e57066a743428571707540d71775e751..2dc0f0734ba33aa2fcbccb033ef2566771cb37ae 100644 (file)
@@ -808,9 +808,9 @@ fail:
        /* we might as well release our claims on endpoints */
        if (ecm->notify)
                ecm->notify->driver_data = NULL;
-       if (ecm->port.out_ep->desc)
+       if (ecm->port.out_ep)
                ecm->port.out_ep->driver_data = NULL;
-       if (ecm->port.in_ep->desc)
+       if (ecm->port.in_ep)
                ecm->port.in_ep->driver_data = NULL;
 
        ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
index 1a7b2dd7d408d1427a8d60b01d15f29ebc8282fd..a9cf20522ffa7b43f779dfe9caab5bacadd5a024 100644 (file)
@@ -319,10 +319,9 @@ fail:
        if (f->hs_descriptors)
                usb_free_descriptors(f->hs_descriptors);
 
-       /* we might as well release our claims on endpoints */
-       if (eem->port.out_ep->desc)
+       if (eem->port.out_ep)
                eem->port.out_ep->driver_data = NULL;
-       if (eem->port.in_ep->desc)
+       if (eem->port.in_ep)
                eem->port.in_ep->driver_data = NULL;
 
        ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
index b651b529c67f070dcd4a545cea8cfc40010602f3..5e04e935d17a1d4b49f03050a2e50c0888c00e8b 100644 (file)
@@ -1259,9 +1259,9 @@ fail:
        /* we might as well release our claims on endpoints */
        if (ncm->notify)
                ncm->notify->driver_data = NULL;
-       if (ncm->port.out_ep->desc)
+       if (ncm->port.out_ep)
                ncm->port.out_ep->driver_data = NULL;
-       if (ncm->port.in_ep->desc)
+       if (ncm->port.in_ep)
                ncm->port.in_ep->driver_data = NULL;
 
        ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
index b1681e45aca76749c65f99a53c943a993cff4ccf..47953fe2035d7d49a9235cc963762b7ae2f1c3fd 100644 (file)
@@ -803,9 +803,9 @@ fail:
        /* we might as well release our claims on endpoints */
        if (rndis->notify)
                rndis->notify->driver_data = NULL;
-       if (rndis->port.out_ep->desc)
+       if (rndis->port.out_ep)
                rndis->port.out_ep->driver_data = NULL;
-       if (rndis->port.in_ep->desc)
+       if (rndis->port.in_ep)
                rndis->port.in_ep->driver_data = NULL;
 
        ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
index 4060c0bd9785cf5a033b2e30981374fd0cdc5fb0..deb437c3b53edaf1620a2136ec83a1a7e8a7a920 100644 (file)
@@ -370,9 +370,9 @@ fail:
                usb_free_descriptors(f->hs_descriptors);
 
        /* we might as well release our claims on endpoints */
-       if (geth->port.out_ep->desc)
+       if (geth->port.out_ep)
                geth->port.out_ep->driver_data = NULL;
-       if (geth->port.in_ep->desc)
+       if (geth->port.in_ep)
                geth->port.in_ep->driver_data = NULL;
 
        ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);