From: "Xuetao (kirin)" <xuetao09@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>,
Alan Stern <stern@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<caiyadong@huawei.com>, <stable@kernel.org>
Subject: Re: [PATCH] usb: core: Fix bandwidth for devices with invalid wBytesPerInterval
Date: Fri, 3 Apr 2026 09:20:46 +0800 [thread overview]
Message-ID: <c2d89ac0-1d5c-45b8-ab68-53214546a7ae@huawei.com> (raw)
In-Reply-To: <2026040221-reclusive-garland-6281@gregkh>
在 2026/4/2 22:09, Greg KH 写道:
> On Thu, Apr 02, 2026 at 09:56:51AM -0400, Alan Stern wrote:
>> On Thu, Apr 02, 2026 at 02:59:35PM +0800, Xuetao (kirin) wrote:
>>> 2、Following Alan's suggestion in another email, should I check whether
>>> wBytesPerInterval is a valid value and handle it in the
>>> usb_parse_ss_endpoint_companion() ?
>>
>> Yes, IMO.
>>
>>> However, when parsing the device descriptor, we do not know whether the
>>> actual data length transmitted by the peripheral is greater than
>>> wBytesPerInterval.
>>
>> Note: wBytesPerInterval is in the endpoint descriptor, not the device
>> descriptor.
>>
Thank you for your review. I will correct the description in the
subsequent patch.
>>> Therefore, would it be sufficient to only add a check for whether
>>> wBytesPerInterval is 0 in the existing flow, and if it is 0, set
>>> wBytesPerInterval to cpu_to_le16(max_tx) by default?
>>>
>>> For example, modify it in the following way:
>>>
>>> if (le16_to_cpu(desc->wBytesPerInterval) > max_tx ||
>>> le16_to_cpu(desc->wBytesPerInterval) == 0) {
>>> dev_notice(ddev, "%s endpoint with wBytesPerInterval of %d in "
>>> "config %d interface %d altsetting %d ep %d: "
>>> "setting to %d\n",
>>> usb_endpoint_xfer_isoc(&ep->desc) ? "Isoc" : "Int",
>>> le16_to_cpu(desc->wBytesPerInterval),
>>> cfgno, inum, asnum, ep->desc.bEndpointAddress,
>>> max_tx);
>>> ep->ss_ep_comp.wBytesPerInterval = cpu_to_le16(max_tx);
>>> }
>>>
>>> Could you please give me some advice? Thanks.
>>
>> Try it and see if it fixes the problems you see with the network
>> adapters.
>>
Okay, I will verify the effectiveness of this modification and provide
feedback on the results.
I guess that for the scenario where wBytesPerInterval is 0, it should be
solvable. However, for the scenario where wBytesPerInterval is 8 but the
peripheral sends a data length greater than 8 (e.g., 16), there might be
an issue. I will test both of the above scenarios.
>> I saw the Greg said not to change the descriptors and just fail the
>> device, but we already make this sort of change to correct other errors
>> so there doesn't seem to be any reason not to do it here as well.
>> Especially if it allows people to use devices that otherwise would not
>> work.
>
> I didn't realize this was on "real" devices, sorry. I thought this was
> only a fuzzing thing. So yes, fix up the broken descriptor after
> warning about it is the correct thing to do.
>
> thanks,
>
> greg k-h
next prev parent reply other threads:[~2026-04-03 1:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 2:14 Tao Xue
2026-04-02 2:45 ` Alan Stern
2026-04-02 3:51 ` Greg KH
2026-04-02 6:59 ` Xuetao (kirin)
2026-04-02 7:10 ` Greg KH
2026-04-02 8:26 ` Xuetao (kirin)
2026-04-02 13:56 ` Alan Stern
2026-04-02 14:09 ` Greg KH
2026-04-02 15:03 ` Michal Pecio
2026-04-03 1:20 ` Xuetao (kirin) [this message]
2026-04-22 13:26 ` Xuetao (kirin)
2026-04-23 9:05 ` Michal Pecio
2026-04-23 9:06 ` [PATCH 1/2] usb: core: Fix root hub descriptor wBytesPerInterval Michal Pecio
2026-04-23 9:09 ` [PATCH 2/2] usb: core: Fix up Interrupt IN endpoints with bogus wBytesPerInterval Michal Pecio
2026-04-23 14:04 ` Alan Stern
2026-04-23 14:55 ` Xuetao (kirin)
2026-04-02 20:17 ` [PATCH] usb: core: Fix bandwidth for devices with invalid wBytesPerInterval Michal Pecio
2026-04-02 9:44 ` Michal Pecio
2026-04-02 11:55 ` Xuetao (kirin)
2026-04-03 7:16 ` Michal Pecio
2026-04-22 6:32 ` Michal Pecio
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=c2d89ac0-1d5c-45b8-ab68-53214546a7ae@huawei.com \
--to=xuetao09@huawei.com \
--cc=caiyadong@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®