usbnet: limit max_mtu based on device's hard_mtu#7203
usbnet: limit max_mtu based on device's hard_mtu#7203dilyanpalauzov wants to merge 1 commit intoraspberrypi:rpi-6.12.yfrom
Conversation
This backport of https://git.kernel.org/netdev/net/c/c7159e960f14 will allow running Raspberry Pi OS kernel in QEMU using passt usb networking, without requiring throttling. The initial problem is described at https://gitlab.com/qemu-project/qemu/-/issues/3268 and https://bugs.passt.top/attachment.cgi?bugid=189. ----- From: Laurent Vivier <lvivier@redhat.com> Date: Mon, 19 Jan 2026 08:55:18 +0100 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: f77f0ae ("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>
|
You're keen - this commit hasn't even hit linux-next yet. Fortunately for you it has a Fixes tag, so I expect it to be automatically back-ported to the LTS branches, including 6.12. If nothing has appeared after a week or two, feel free to add a comment. |
|
The patch is included in Linux 6.12.68. When can I expect that an image is released at https://www.raspberrypi.org/software/operating-systems/, which contains at least kernel 6.12.68? |
|
i meant 6.12.58 |
|
Arr, I meant 6.12.68 |
|
Totay is "Friday 13”, which explains the typos with the version. |
|
You can get 6.12.70 from rpi-update (read the caveats before updating). |
|
I do not want to get 6.12.70 with
So it only makes sense if this patch is included in the image, before QEMU loads the image, not installing it afterwards. |
|
Already addressed:
|
|
And your URL is out of date - it should be a dotcom address: https://www.raspberrypi.com/software/operating-systems/ |
This backport of https://git.kernel.org/netdev/net/c/c7159e960f14 will allow running Raspberry Pi OS kernel in QEMU using passt usb networking, without requiring throttling.
The initial problem is described at https://gitlab.com/qemu-project/qemu/-/issues/3268 and https://bugs.passt.top/attachment.cgi?bugid=189.
From: Laurent Vivier <lvivier working in redhat.com>
Date: Mon, 19 Jan 2026 08:55:18 +0100
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: f77f0ae ("net: use core MTU range checking in USB NIC drivers")
Link: https://bugs.passt.top/show_bug.cgi?id=189
Reviewed-by: Stefano Brivio <sbrivio working in redhat.com>
Link: https://patch.msgid.link/20260119075518.2774373-1-lvivier@redhat.com