Re: [PATCH net] usbnet: cap max_mtu for drivers without bind callback

From: Jakub Kicinski

Date: Thu Jul 23 2026 - 11:50:24 EST


On Fri, 17 Jul 2026 17:16:26 +0200 Laurent Vivier wrote:
> Commit c7159e960f14 ("usbnet: limit max_mtu based on device's hard_mtu")
> caps max_mtu inside the if (info->bind) block in usbnet_probe().

Okay... but before that commit the logic was also missing,
and that commit only refines the condition. I don't think
that's the right commit for Fixes.

> Drivers without a bind callback never enter this block, so max_mtu
> stays at ETH_MAX_MTU.
>
> QEMU's usb-net device (0x0525/0xa4a2) is claimed by the cdc_subset
> driver which has no bind callback. The guest accepts any MTU from DHCP
> (e.g. 65520 from passt), leading to TCP segments that exceed the
> device's 2048-byte receive buffer and are silently dropped.
>
> Move the max_mtu capping after the if/else block so it applies to all
> usbnet drivers.

A short explanation here why the changes was made under the bind would
be quite useful (presumably it was done there because that's where the
existing MTU check was, and the existing MTU check only mattered if the
device specific callback could modify the state etc.)

It feels like we should update the max_mtu instead of capping it later
for devices without bind (note that only a device with bind sets
NOMAXMTU, too)
--
pw-bot: cr