usbnet: fix crash due to missing BQL accounting after resume
Subsystems (5)
PATCH 1/1 usbnet: fix crash due to missing BQL accounting after resume
In commit 7ff14c52049e ("usbnet: Add support for Byte Queue Limits (BQL)"), it was missed that usbnet_resume() may enqueue SKBs using __skb_queue_tail() without reporting them to BQL. As a result, the next call to netdev_completed_queue() triggers a BUG_ON() in dql_completed(), since the SKBs queued during resume were never accounted for.
This patch fixes the issue by adding a corresponding netdev_sent_queue() call in usbnet_resume() when SKBs are queued after suspend. Because dev->txq.lock is held at this point, no concurrent calls to netdev_sent_queue() from usbnet_start_xmit() can occur.
The crash can be reproduced by generating network traffic (e.g. iperf3 -c ... -t 0), suspending the system, and then waking it up (e.g. rtcwake -m mem -s 5).
When testing USB2 Android tethering (cdc_ncm), the system crashed within three suspend/resume cycles without this patch. With the patch applied, no crashes were observed after 90 cycles. Testing with an AX88179 USB Ethernet adapter also showed no crashes.
--- drivers/net/usb/usbnet.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/usbnet.c +1 -0
@@ -1984,6 +1984,7 @@ int usbnet_resume(struct usb_interface *intf) }else {netif_trans_update (dev->net);__skb_queue_tail (&dev->txq, skb); +netdev_sent_queue (dev->net, skb->len); } }
Signature · 1 line
2.43.0
Quoted 21 lines · Simon Schippers
In commit
7ff14c52049e("usbnet: Add support for Byte Queue Limits (BQL)"), it was missed thatusbnet_resume()may enqueue SKBs using__skb_queue_tail()without reporting them to BQL. As a result, the next call tonetdev_completed_queue()triggers aBUG_ON()indql_completed(), since the SKBs queued during resume were never accounted for.This patch fixes the issue by adding a corresponding
netdev_sent_queue()call inusbnet_resume()when SKBs are queued after suspend. Becausedev->txq.lockis held at this point, no concurrent calls tonetdev_sent_queue()fromusbnet_start_xmit()can occur.The crash can be reproduced by generating network traffic (e.g. iperf3 -c ... -t 0), suspending the system, and then waking it up (e.g. rtcwake -m mem -s 5).
When testing USB2 Android tethering (
cdc_ncm), the system crashed within three suspend/resume cycles without this patch. With the patch applied, no crashes were observed after 90 cycles. Testing with an AX88179 USB Ethernet adapter also showed no crashes.
Quoted 5 lines
Reported-by Bard Liao <[email protected]>Tested-by Bard Liao <[email protected]>Tested-by Simon Schippers <[email protected]>Signed-off-by Simon Schippers <[email protected]>---
We request/need Fixes: tag for net patches, in the footer. And we prefer it to be the first tag.
...
Thanks !
Quoted 18 lines
drivers/net/usb/usbnet.c | 1 + 1 file changed, 1 insertion(+)drivers/net/usb/usbnet.c +1
-1@@ -1984,6 +1984,7 @@ int usbnet_resume(struct usb_interface *intf) }else {netif_trans_update (dev->net);__skb_queue_tail (&dev->txq, skb); +netdev_sent_queue (dev->net, skb->len); } } --2.43.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Tue, 13 Jan 2026 08:51:38 +0100 you wrote:
In commit
7ff14c52049e("usbnet: Add support for Byte Queue Limits (BQL)"), it was missed thatusbnet_resume()may enqueue SKBs using__skb_queue_tail()without reporting them to BQL. As a result, the next call tonetdev_completed_queue()triggers aBUG_ON()indql_completed(), since the SKBs queued during resume were never accounted for.
Quoted 6 lines
This patch fixes the issue by adding a corresponding
netdev_sent_queue()call inusbnet_resume()when SKBs are queued after suspend. Becausedev->txq.lockis held at this point, no concurrent calls tonetdev_sent_queue()fromusbnet_start_xmit()can occur.[...]
Here is the summary with links:
- [net] usbnet: fix crash due to missing BQL accounting after resume
https://git.kernel.org/netdev/net/c/c4efd7a770c5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html