diff options
| author | Alice Mikityanska <alice@isovalent.com> | 2026-08-22 15:01:17 +0300 |
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2026-08-27 15:47:18 +0200 |
| commit | 0b13256ce37b66dbd0e4ce78d5bee32fd38db1a5 (patch) | |
| tree | f6d28ba20e028279fdc90a8a15b1104986673244 /scripts/basic | |
| parent | c27c449d455aafd9018a3cbab150f1c42c87923f (diff) | |
| download | linux-0b13256ce37b66dbd0e4ce78d5bee32fd38db1a5.tar.gz linux-0b13256ce37b66dbd0e4ce78d5bee32fd38db1a5.zip | |
net: Guard for gso_segs overflow in skb_segment
skb_segment calculates 32-bit partial_segs as len / gso_size, and then
assigns it to the 16-bit gso_segs field. The division might overflow in
some edge cases where the SKB is BIG TCP (65536 <= len <= 8*65535), and
gso_size < TCP_MIN_GSO_SIZE = 8. While normally this can't happen due to
TCP_MIN_GSO_SIZE, an AF_PACKET PACKET_VNET_HDR socket could generate
such a malformed packet until the previous patch.
Blocking malformed virtio_net packets was implemented in the previous
patch, but this patch clamps partial_segs in skb_segment itself for more
generic robustness. Should len / gso_size happen to be bigger than
65535 in partial GSO, skb_segment will now just produce more than two
output SKBs, all of which will be valid with gso_segs <= 65535.
In order to catch possible other cases of too many partial_segs, add a
DEBUG_NET_WARN_ON_ONCE when len / gso_size happens to be too big.
Signed-off-by: Alice Mikityanska <alice@isovalent.com>
Link: https://patch.msgid.link/20260822120117.1163423-3-alice.kernel@fastmail.im
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
