Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cheng Yongkang" <teel4res@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: core: use the clamped bMaxBurst and Mult for the wBytesPerInterval check
Date: Tue, 17 Nov 2026 03:47:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-218159@kernel.org> (raw)
In-Reply-To: <20261117034311.538314-1-teel4res@gmail.com>

> usb_parse_ss_endpoint_companion() clamps bMaxBurst to 15 and the isoc
> Mult to 3 in ep->ss_ep_comp, but then computes max_tx for the
> wBytesPerInterval check from the original descriptor. A device with an
> invalid bMaxBurst or Mult can then keep a wBytesPerInterval that the
> clamped endpoint cannot carry.
> 
> With wMaxPacketSize 1024, bMaxBurst 16 and Mult 1, bMaxBurst becomes 15
> but wBytesPerInterval is limited to 17408 instead of 16384.
> usb_submit_urb() uses the clamped values and rejects isoc frames above
> 16384, while usb_endpoint_max_periodic_payload() returns 17408, which
> xHCI uses as the Max ESIT Payload. The same endpoint context gets a Max
> Burst of 15, so the two fields disagree.
> 
> The rest of the code treats ep->ss_ep_comp as the sanitized copy of the
> descriptor. usb_parse_endpoint() checks and fixes ep->desc the same
> way, and everything after parsing, including usb_submit_urb(),
> usb_endpoint_max_periodic_payload() and xHCI, reads only these copies.
> max_tx itself already takes wMaxPacketSize from ep->desc. Before commit
> 842f16905dfc ("USB: remove the usb_host_ss_ep_comp structure"), the
> clamps modified the descriptor in place, so max_tx was computed from
> the clamped values. That commit moved the clamps to the copy but left
> max_tx reading the original descriptor.
> 
> Compute max_tx from ep->ss_ep_comp.
> 
> Fixes: 842f16905dfc ("USB: remove the usb_host_ss_ep_comp structure")
> Signed-off-by: Cheng Yongkang <teel4res@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117034311.538314-1-teel4res@gmail.com?part=1


      reply	other threads:[~2026-11-17  3:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 16:37 [BUG] usb: core: wBytesPerInterval checked with unsanitized bMaxBurst Cheng Yongkang
2026-11-16 18:51 ` Alan Stern
2026-11-17  3:43   ` [PATCH] usb: core: use the clamped bMaxBurst and Mult for the wBytesPerInterval check Cheng Yongkang
2026-11-17  3:47     ` 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-218159@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=teel4res@gmail.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