mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:24:45 +01:00
net: mctp: Fix tx queue stall
The tx queue can become permanently stuck in a stopped state due to a
race condition between the URB submission path and its completion
callback.
The URB completion callback can run immediately after usb_submit_urb()
returns, before the submitting function calls netif_stop_queue(). If
this occurs, the queue state management becomes desynchronized, leading
to a stall where the queue is never woken.
Fix this by moving the netif_stop_queue() call to before submitting the
URB. This closes the race window by ensuring the network stack is aware
the queue is stopped before the URB completion can possibly run.
Fixes: 0791c0327a ("net: mctp: Add MCTP USB transport driver")
Signed-off-by: Jinliang Wang <jinliangw@google.com>
Acked-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://patch.msgid.link/20251027065530.2045724-1-jinliangw@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
53110232c9
commit
da2522df3f
1 changed files with 5 additions and 3 deletions
|
|
@ -96,11 +96,13 @@ static netdev_tx_t mctp_usb_start_xmit(struct sk_buff *skb,
|
|||
skb->data, skb->len,
|
||||
mctp_usb_out_complete, skb);
|
||||
|
||||
/* Stops TX queue first to prevent race condition with URB complete */
|
||||
netif_stop_queue(dev);
|
||||
rc = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (rc)
|
||||
if (rc) {
|
||||
netif_wake_queue(dev);
|
||||
goto err_drop;
|
||||
else
|
||||
netif_stop_queue(dev);
|
||||
}
|
||||
|
||||
return NETDEV_TX_OK;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue