public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] usbnet: fix crash due to missing BQL accounting after resume
@ 2026-01-13  7:51 Simon Schippers
  2026-01-13  8:33 ` Eric Dumazet
  2026-01-16  3:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Schippers @ 2026-01-13  7:51 UTC (permalink / raw)
  To: oneukum, andrew+netdev, davem, edumazet, kuba, pabeni, dnlplm,
	netdev, linux-usb, linux-kernel
  Cc: Simon Schippers, Bard Liao

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.

Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Tested-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Tested-by: Simon Schippers <simon.schippers@tu-dortmund.de>
Signed-off-by: Simon Schippers <simon.schippers@tu-dortmund.de>
---
 drivers/net/usb/usbnet.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 36742e64cff7..35789ff4dd55 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] usbnet: fix crash due to missing BQL accounting after resume
  2026-01-13  7:51 [PATCH net] usbnet: fix crash due to missing BQL accounting after resume Simon Schippers
@ 2026-01-13  8:33 ` Eric Dumazet
  2026-01-16  3:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2026-01-13  8:33 UTC (permalink / raw)
  To: Simon Schippers
  Cc: oneukum, andrew+netdev, davem, kuba, pabeni, dnlplm, netdev,
	linux-usb, linux-kernel, Bard Liao

On Tue, Jan 13, 2026 at 8:51 AM Simon Schippers
<simon.schippers@tu-dortmund.de> wrote:
>
> 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.
>
> Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Tested-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Tested-by: Simon Schippers <simon.schippers@tu-dortmund.de>
> Signed-off-by: Simon Schippers <simon.schippers@tu-dortmund.de>
> ---

We request/need Fixes: tag for net patches, in the footer.
And we prefer it to be the first tag.

Fixes: 7ff14c52049e ("usbnet: Add support for Byte Queue Limits (BQL)")
...
Reviewed-by: Eric Dumazet <edumazet@google.com>

Thanks !

>  drivers/net/usb/usbnet.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> index 36742e64cff7..35789ff4dd55 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] usbnet: fix crash due to missing BQL accounting after resume
  2026-01-13  7:51 [PATCH net] usbnet: fix crash due to missing BQL accounting after resume Simon Schippers
  2026-01-13  8:33 ` Eric Dumazet
@ 2026-01-16  3:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-16  3:50 UTC (permalink / raw)
  To: Simon Schippers
  Cc: oneukum, andrew+netdev, davem, edumazet, kuba, pabeni, dnlplm,
	netdev, linux-usb, linux-kernel, yung-chuan.liao

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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 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.
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-16  3:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13  7:51 [PATCH net] usbnet: fix crash due to missing BQL accounting after resume Simon Schippers
2026-01-13  8:33 ` Eric Dumazet
2026-01-16  3:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox