udp: allow header check for dodgy GSO_UDP_L4 packets.
authorAndrew Melnychenko <andrew@daynix.com>
Wed, 7 Dec 2022 11:35:53 +0000 (13:35 +0200)
committerSalvatore Bonaccorso <carnil@debian.org>
Mon, 26 Aug 2024 19:47:39 +0000 (21:47 +0200)
Origin: https://git.kernel.org/linus/1fd54773c26787b9aea80e2f62c7d0780ea444d0

Allow UDP_L4 for robust packets.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name udp-allow-header-check-for-dodgy-GSO_UDP_L4-packets.patch

net/ipv4/udp_offload.c
net/ipv6/udp_offload.c

index 794ea24292f62cac6d72dc0bb1a47a52d88fd299..3322b67c01c707171eee001fb2eaf8121fd627c5 100644 (file)
@@ -387,7 +387,8 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
        if (!pskb_may_pull(skb, sizeof(struct udphdr)))
                goto out;
 
-       if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
+       if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 &&
+           !skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST))
                return __udp_gso_segment(skb, features, false);
 
        mss = skb_shinfo(skb)->gso_size;
index b98c4c8d8e274671f1484fd07b6610ac8755a779..7f0d6ba31ed4c714ade92b688d5dd08c4d0e33f1 100644 (file)
@@ -42,7 +42,8 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
                if (!pskb_may_pull(skb, sizeof(struct udphdr)))
                        goto out;
 
-               if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
+               if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 &&
+                   !skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST))
                        return __udp_gso_segment(skb, features, true);
 
                mss = skb_shinfo(skb)->gso_size;