diff options
author | Jeff Westfahl <jeff.westfahl@ni.com> | 2014-05-29 08:49:41 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-06-19 17:06:46 +0200 |
commit | a9232076374334ca2bc2a448dfde96d38a54349a (patch) | |
tree | fc5be5559891d8aaf0b4bfeb8fc395f63456162d /drivers/usb | |
parent | usb: dwc3: dwc3-omap: Disable/Enable only wrapper interrupts in prepare/complete (diff) | |
download | linux-a9232076374334ca2bc2a448dfde96d38a54349a.tar.xz linux-a9232076374334ca2bc2a448dfde96d38a54349a.zip |
usb: gadget: u_ether: synchronize with transmit when stopping queue
When disconnecting, it's possible that another thread has already made it
into eth_start_xmit before we call netif_stop_queue. This can lead to a
crash as eth_start_xmit tries to use resources that gether_disconnect is
freeing. Use netif_tx_lock/unlock around netif_stop_queue to ensure no
threads are executing during the remainder of gether_disconnect.
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Tested-by: Jaeden Amero <jaeden.amero@ni.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/u_ether.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 3d78a8844e43..97b027724ee7 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c @@ -1120,7 +1120,10 @@ void gether_disconnect(struct gether *link) DBG(dev, "%s\n", __func__); + netif_tx_lock(dev->net); netif_stop_queue(dev->net); + netif_tx_unlock(dev->net); + netif_carrier_off(dev->net); /* disable endpoints, forcing (synchronous) completion |