Skip to content

Commit 9e0d18f

Browse files
edumazetgregkh
authored andcommitted
net: check dev->gso_max_size in gso_features_check()
[ Upstream commit 24ab059 ] Some drivers might misbehave if TSO packets get too big. GVE for instance uses a 16bit field in its TX descriptor, and will do bad things if a packet is bigger than 2^16 bytes. Linux TCP stack honors dev->gso_max_size, but there are other ways for too big packets to reach an ndo_start_xmit() handler : virtio_net, af_packet, GRO... Add a generic check in gso_features_check() and fallback to GSO when needed. gso_max_size was added in the blamed commit. Fixes: 82cc1a7 ("[NET]: Add per-connection option to set max TSO frame size") Signed-off-by: Eric Dumazet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 59dc16c commit 9e0d18f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/core/dev.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,6 +3523,9 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb,
35233523
if (gso_segs > dev->gso_max_segs)
35243524
return features & ~NETIF_F_GSO_MASK;
35253525

3526+
if (unlikely(skb->len >= READ_ONCE(dev->gso_max_size)))
3527+
return features & ~NETIF_F_GSO_MASK;
3528+
35263529
if (!skb_shinfo(skb)->gso_type) {
35273530
skb_warn_bad_offload(skb);
35283531
return features & ~NETIF_F_GSO_MASK;

0 commit comments

Comments
 (0)