From: Cheng Yongkang <teel4res@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [BUG] usb: core: wBytesPerInterval checked with unsanitized bMaxBurst
Date: Sun, 15 Nov 2026 08:37:01 -0800 [thread overview]
Message-ID: <20261115163701.226491-1-teel4res@gmail.com> (raw)
Hi Greg, Alan,
I hit a corner case in usb_parse_ss_endpoint_companion(). It needs a
SuperSpeed device with an invalid bMaxBurst or Mult, so it may not be
worth fixing.
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. The stored
wBytesPerInterval can then be larger than the clamped endpoint can
carry.
With wMaxPacketSize=1024, bMaxBurst=16, Mult=1 and
wBytesPerInterval=65535, bMaxBurst becomes 15 but wBytesPerInterval
is set 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 also
uses as the Max ESIT Payload.
On v7.3 with a virtual SuperSpeed device over USB/IP, the kernel
logged "setting to 17408", and 16385- and 17000-byte isoc frames
failed with -EMSGSIZE. I only tested the bMaxBurst case; the Mult
case follows from the same code. The code is unchanged in
next-20261113.
Using ep->ss_ep_comp in the max_tx calculation fixes it:
- max_tx = (desc->bMaxBurst + 1) *
- (USB_SS_MULT(desc->bmAttributes)) *
+ max_tx = (ep->ss_ep_comp.bMaxBurst + 1) *
+ (USB_SS_MULT(ep->ss_ep_comp.bmAttributes)) *
usb_endpoint_maxp(&ep->desc);
else if (usb_endpoint_xfer_int(&ep->desc))
max_tx = usb_endpoint_maxp(&ep->desc) *
- (desc->bMaxBurst + 1);
+ (ep->ss_ep_comp.bMaxBurst + 1);
I can send a patch if you want one.
Thanks,
Cheng Yongkang
next reply other threads:[~2026-11-15 16:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 16:37 Cheng Yongkang [this message]
2026-11-16 18:51 ` [BUG] usb: core: wBytesPerInterval checked with unsanitized bMaxBurst 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
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=20261115163701.226491-1-teel4res@gmail.com \
--to=teel4res@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.