Re: [PATCH] usb: core: Remove unused SuperSpeed EP0 maxpacket handling
From: Alan Stern
Date: Mon Aug 10 2026 - 10:16:38 EST
On Mon, Aug 10, 2026 at 08:12:12AM +0200, Michal Pecio wrote:
> 512 is the only control endpoint max packet size defined by USB 3,
> encoded logarithmically as 9 in the 8-bit bMaxPacketSize0 field.
>
> Up to v6.5 in 2023, core assumed 512 and ignored the descriptor,
> but now it tries to decode and use it. One (emulated) device was
> found to specify 8, see commit c78c3644b772 ("usb: Fix regression
> caused by invalid ep0 maxpacket in virtual SuperSpeed device").
>
> Thankfully, xhci_setup_addressable_virt_dev() always initializes
> EP 0 packet size to 512 and xhci_check_[ep0]_maxpacket() has never
> been called on SuperSpeed endpoints, which means that none of this
> has any effect and 512 works for all devices ever supported. The
> regression was caused by core refusing to enumerate bogus devices.
>
> Drop pointless calculations and correct misleading logs, because
> we don't actually use out of spec packet sizes. Moreover, some HCs
> (NEC/Renesas, old AMD) reject them, though others don't and there
> is some effect - enumeration fails with -EOVERFLOW or -EPROTO.
>
> But those effects are only seen when patching xhci-hcd; altering
> ep0.desc does nothing, even after the usb_ep0_reinit() call.
>
> Signed-off-by: Michal Pecio <michal.pecio@xxxxxxxxx>
> ---
>
> By the way, xhci-hcd only updates max packet size at full-speed,
> which means that the high-speed workaround doesn't work either.
>
> Renesas does accept high-speed overrides, this time Etron doesn't.
>
> Whether any of that works correctly with actual devices with unusual
> packet size, and whether they really need a workaround (unlikely if
> all their descriptors are shorter than bMaxPacketSize0) is unknown.
>
> drivers/usb/core/hub.c | 23 +++++++++--------------
> 1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 5262e11c12cd..d9409943f388 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -5143,22 +5143,14 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
>
> /*
> * Check the ep0 maxpacket guess and correct it if necessary.
> - * maxp0 is the value stored in the device descriptor;
> - * i is the value it encodes (logarithmic for SuperSpeed or greater).
> */
Nit: Since this is now a one-line comment, it should be written as:
/* Check the ep0 maxpacket guess and correct it if necessary. */
Alan Stern