linux/drivers/net/usb
Laurent Vivier c7159e960f usbnet: limit max_mtu based on device's hard_mtu
The usbnet driver initializes net->max_mtu to ETH_MAX_MTU before calling
the device's bind() callback. When the bind() callback sets
dev->hard_mtu based the device's actual capability (from CDC Ethernet's
wMaxSegmentSize descriptor), max_mtu is never updated to reflect this
hardware limitation).

This allows userspace (DHCP or IPv6 RA) to configure MTU larger than the
device can handle, leading to silent packet drops when the backend sends
packet exceeding the device's buffer size.

Fix this by limiting net->max_mtu to the device's hard_mtu after the
bind callback returns.

See https://gitlab.com/qemu-project/qemu/-/issues/3268 and
    https://bugs.passt.top/attachment.cgi?bugid=189

Fixes: f77f0aee4d ("net: use core MTU range checking in USB NIC drivers")
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Link: https://bugs.passt.top/show_bug.cgi?id=189
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Link: https://patch.msgid.link/20260119075518.2774373-1-lvivier@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-01-20 18:58:54 -08:00
..
Kconfig net: usb: lan78xx: add support for generic net selftests via ethtool 2025-08-25 16:22:19 -07:00
Makefile
aqc111.c net: usb: aqc111: debug info before sanitation 2025-05-30 12:14:53 +01:00
aqc111.h
asix.h usbnet: asix AX88772: leave the carrier control to phylink 2025-04-10 18:42:50 -07:00
asix_common.c net: usb: asix: validate PHY address before use 2025-12-28 09:05:12 +01:00
asix_devices.c net: usb: asix_devices: Check return value of usbnet_get_endpoints 2025-10-29 17:51:48 -07:00
ax88172a.c net: usb: asix: validate PHY address before use 2025-12-28 09:05:12 +01:00
ax88179_178a.c
catc.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
cdc-phonet.c
cdc_eem.c
cdc_ether.c cdc_ether|r8152: ThinkPad Hybrid USB-C/A Dock quirk 2025-03-17 21:25:25 +01:00
cdc_mbim.c net: usb: cdc_mbim: fix Telit Cinterion FE990A name 2025-02-28 17:55:02 -08:00
cdc_ncm.c cdc_ncm: Flag Intel OEM version of Fibocom L850-GL as WWAN 2025-08-19 17:16:37 -07:00
cdc_subset.c
ch9200.c net: ch9200: fix uninitialised access during mii_nway_restart 2025-05-28 19:10:04 -07:00
cx82310_eth.c
dm9601.c net: usb: dm9601: remove broken SR9700 support 2026-01-15 19:47:28 -08:00
gl620a.c usbnet: gl620a: fix endpoint checking in genelink_bind() 2025-02-27 11:35:10 +01:00
hso.c
huawei_cdc_ncm.c
int51x1.c
ipheth.c usbnet: ipheth: document scope of NCM implementation 2025-01-28 12:16:32 +01:00
kalmia.c
kaweth.c
lan78xx.c net: usb: lan78xx: fix use of improperly initialized dev->chipid in lan78xx_reset 2025-10-15 18:27:48 -07:00
lan78xx.h
lg-vl600.c
mcs7830.c
net1080.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
pegasus.c net: usb: pegasus: fix memory leak in update_eth_regs_async() 2026-01-08 08:40:20 -08:00
pegasus.h
plusb.c
qmi_wwan.c net: usb: qmi_wwan: initialize MAC header offset in qmimux_rx_fixup 2025-11-03 17:36:49 -08:00
r8152.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-10-16 11:06:28 -07:00
r8153_ecm.c cdc_ether|r8152: ThinkPad Hybrid USB-C/A Dock quirk 2025-03-17 21:25:25 +01:00
rndis_host.c Revert "rndis_host: Flag RNDIS modems as WWAN devices" 2025-04-25 18:46:13 -07:00
rtl8150.c net: usb: rtl8150: fix memory leak on usb_submit_urb() failure 2025-12-23 12:12:34 +01:00
sierra_net.c usb: net: sierra: check for no status endpoint 2025-07-15 16:02:13 -07:00
smsc75xx.c
smsc75xx.h
smsc95xx.c net: usb: smsc95xx: add support for ethtool pause parameters 2025-07-21 17:42:12 -07:00
smsc95xx.h
sr9700.c net: usb: sr9700: fix incorrect command used to write single register 2025-12-30 10:31:54 +01:00
sr9700.h
sr9800.c
sr9800.h
usbnet.c usbnet: limit max_mtu based on device's hard_mtu 2026-01-20 18:58:54 -08:00
zaurus.c