From: David Brownell Date: Wed, 19 Dec 2007 19:27:51 +0000 (-0800) Subject: USB: gadget: ethernet error path potential oops fix X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e7b13ec9235b9fded90f826ceeb8c34548631351;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git USB: gadget: ethernet error path potential oops fix Fix potential (never-observed) oops on rare error path, bugzilla #9594. Fix uses the same test as used earlier. Also make the adjacent "else" block look like an "else" block instead of hiding like a bug. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 9e732bff9df0..a70e255402b8 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -1067,19 +1067,19 @@ done: /* on error, disable any endpoints */ if (result < 0) { - if (!subset_active(dev)) + if (!subset_active(dev) && dev->status_ep) (void) usb_ep_disable (dev->status_ep); dev->status = NULL; (void) usb_ep_disable (dev->in_ep); (void) usb_ep_disable (dev->out_ep); dev->in = NULL; dev->out = NULL; - } else + } /* activate non-CDC configs right away * this isn't strictly according to the RNDIS spec */ - if (!cdc_active (dev)) { + else if (!cdc_active (dev)) { netif_carrier_on (dev->net); if (netif_running (dev->net)) { spin_unlock (&dev->lock);