* [PATCH] usb: gadget: u_ether: synchronize with transmit when stopping queue
@ 2014-05-29 6:49 Vicentiu Neagoe
0 siblings, 0 replies; 2+ messages in thread
From: Vicentiu Neagoe @ 2014-05-29 6:49 UTC (permalink / raw)
To: balbi; +Cc: linux-usb, linux-kernel, Jeff Westfahl
From: Jeff Westfahl <jeff.westfahl@ni.com>
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>
---
drivers/usb/gadget/u_ether.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index b7d4f82..085a76e 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
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] usb: gadget: u_ether: synchronize with transmit when stopping queue
@ 2014-06-13 18:23 Vicentiu Neagoe
0 siblings, 0 replies; 2+ messages in thread
From: Vicentiu Neagoe @ 2014-06-13 18:23 UTC (permalink / raw)
To: balbi; +Cc: linux-usb, linux-kernel, Jeff Westfahl
From: Jeff Westfahl <jeff.westfahl@ni.com>
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>
---
drivers/usb/gadget/u_ether.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index b7d4f82..085a76e 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
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-13 18:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-29 6:49 [PATCH] usb: gadget: u_ether: synchronize with transmit when stopping queue Vicentiu Neagoe
2014-06-13 18:23 Vicentiu Neagoe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.