From 3a383cc0b8cc33af188fe2062b6ba5a69af25fa7 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Mon, 19 Sep 2016 11:05:43 +0200
Subject: [PATCH] Revert "usb: gadget: NCM: Protect dev->port_usb using
 dev->lock"

This reverts commit c9ffc78745f89e300fe704348dd8e6800acf4d18 as it was
reported to be broken.

Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Jim Baxter <jim_baxter@mentor.com>
Cc: Harish Jenny K N <harish_kandiga@mentor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/gadget/function/u_ether.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
index 8cb08033b7c1..9c8c9ed1dc9e 100644
--- a/drivers/usb/gadget/function/u_ether.c
+++ b/drivers/usb/gadget/function/u_ether.c
@@ -553,16 +553,14 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
 		spin_lock_irqsave(&dev->lock, flags);
 		if (dev->port_usb)
 			skb = dev->wrap(dev->port_usb, skb);
+		spin_unlock_irqrestore(&dev->lock, flags);
 		if (!skb) {
 			/* Multi frame CDC protocols may store the frame for
 			 * later which is not a dropped frame.
 			 */
 			if (dev->port_usb &&
-					dev->port_usb->supports_multi_frame) {
-				spin_unlock_irqrestore(&dev->lock, flags);
+					dev->port_usb->supports_multi_frame)
 				goto multiframe;
-			}
-			spin_unlock_irqrestore(&dev->lock, flags);
 			goto drop;
 		}
 	}
@@ -580,7 +578,6 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
 		req->zero = 0;
 	else
 		req->zero = 1;
-	spin_unlock_irqrestore(&dev->lock, flags);
 
 	/* use zlp framing on tx for strict CDC-Ether conformance,
 	 * though any robust network rx path ignores extra padding.
-- 
2.30.9