]> git.hungrycats.org Git - linux/commitdiff
net: avoid skb_warn_bad_offload false positives on UFO
authorWillem de Bruijn <willemb@google.com>
Tue, 8 Aug 2017 18:22:55 +0000 (14:22 -0400)
committerSasha Levin <alexander.levin@verizon.com>
Sun, 10 Sep 2017 20:36:09 +0000 (16:36 -0400)
[ Upstream commit 8d63bee643f1fb53e472f0e135cae4eb99d62d19 ]

skb_warn_bad_offload triggers a warning when an skb enters the GSO
stack at __skb_gso_segment that does not have CHECKSUM_PARTIAL
checksum offload set.

Commit b2504a5dbef3 ("net: reduce skb_warn_bad_offload() noise")
observed that SKB_GSO_DODGY producers can trigger the check and
that passing those packets through the GSO handlers will fix it
up. But, the software UFO handler will set ip_summed to
CHECKSUM_NONE.

When __skb_gso_segment is called from the receive path, this
triggers the warning again.

Make UFO set CHECKSUM_UNNECESSARY instead of CHECKSUM_NONE. On
Tx these two are equivalent. On Rx, this better matches the
skb state (checksum computed), as CHECKSUM_NONE here means no
checksum computed.

See also this thread for context:
http://patchwork.ozlabs.org/patch/799015/

Fixes: b2504a5dbef3 ("net: reduce skb_warn_bad_offload() noise")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
net/core/dev.c
net/ipv4/udp_offload.c
net/ipv6/udp_offload.c

index 6581775b2ed923e2df65faae89a36d53a65d4797..bb711e5e345b9c983cb1f5b63999c22faa962be9 100644 (file)
@@ -2466,7 +2466,7 @@ static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
 {
        if (tx_path)
                return skb->ip_summed != CHECKSUM_PARTIAL &&
-                      skb->ip_summed != CHECKSUM_NONE;
+                      skb->ip_summed != CHECKSUM_UNNECESSARY;
 
        return skb->ip_summed == CHECKSUM_NONE;
 }
index dfcab88c3e747f18998dd648e2d7f2ca6f8435ea..8f27dce93f713efc7aaebe7813e653e07fdd600d 100644 (file)
@@ -231,7 +231,7 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
        if (uh->check == 0)
                uh->check = CSUM_MANGLED_0;
 
-       skb->ip_summed = CHECKSUM_NONE;
+       skb->ip_summed = CHECKSUM_UNNECESSARY;
 
        /* Fragment the skb. IP headers of the fragments are updated in
         * inet_gso_segment()
index 01582966ffa0b18672d3a7c8ec0ec12f1a73abba..2e3c12eeca0770ce73fc8b0f7d4244c7e00df1a7 100644 (file)
@@ -86,7 +86,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
                if (uh->check == 0)
                        uh->check = CSUM_MANGLED_0;
 
-               skb->ip_summed = CHECKSUM_NONE;
+               skb->ip_summed = CHECKSUM_UNNECESSARY;
 
                /* Check if there is enough headroom to insert fragment header. */
                tnl_hlen = skb_tnl_header_len(skb);