提交 a9232076 编写于 作者: J Jeff Westfahl 提交者: Felipe Balbi

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: NJeff Westfahl <jeff.westfahl@ni.com>
Tested-by: NJaeden Amero <jaeden.amero@ni.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 02dae36a
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册