Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "William A. Kennington III" <william@wkennington.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH net] net: usb: cdc_ncm: don't flush the TX timer into a stopped queue
Date: Wed, 18 Nov 2026 03:54:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-220056@kernel.org> (raw)
In-Reply-To: <20261118034122.315979-1-william@wkennington.com>

> cdc_ncm_txpath_bh() calls usbnet_start_xmit() directly without checking
> whether usbnet has stopped the netdev TX queue. Since commit
> ad70411a978d ("usbnet: fix kernel crash after disconnect"),
> usbnet_start_xmit() frees any NTB submitted while the queue is stopped
> and increments tx_dropped.
> 
> This triggers routinely under bulk load. With the default 16 KiB NTBs,
> usbnet only allows MAX_QUEUE_MEMORY / tx_max = 5 TX URBs in flight, so a
> bulk TCP stream stops the queue constantly. The TX timer is armed while
> an NTB is partly filled and keeps running after a subsequent packet
> sends that NTB out full; when the timer fires while all 5 URBs are still
> in flight, any frame left in tx_rem_skb or tx_curr_skb is flushed into a
> new NTB and dropped by usbnet, causing steady tx_dropped increments and
> TCP retransmits.
> 
> While TX URBs are in flight (dev->txq) or completed and awaiting
> usbnet_bh() (dev->done), usbnet will wake the queue again. When the
> queue is stopped under those conditions and cdc_ncm has buffered TX
> frames, restart the timer instead of flushing into usbnet_start_xmit().
> Keep the existing flush path when nothing is queued to wake the device,
> the interface is down, or the timer is disabled (tx_timer_usecs = 0), so
> the timer cannot rearm indefinitely.
> 
> Check the state under ctx->mtx inside netif_tx_lock_bh(), matching the
> lock order on the transmit path and keeping tx_reason_timeout
> serialized.
> 
> Fixes: ad70411a978d ("usbnet: fix kernel crash after disconnect")
> Signed-off-by: William A. Kennington III <william@wkennington.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118034122.315979-1-william@wkennington.com?part=1


      reply	other threads:[~2026-11-18  3:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  3:41 [PATCH net] net: usb: cdc_ncm: don't flush the TX timer into a stopped queue William A. Kennington III
2026-11-18  3:54 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-220056@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=william@wkennington.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox