summaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_checksum.c
diff options
context:
space:
mode:
authorAlexey Kodanev <alexey.kodanev@oracle.com>2018-02-15 20:18:43 +0300
committerDavid S. Miller <davem@davemloft.net>2018-02-16 15:57:42 -0500
commit15f35d49c93f4fa9875235e7bf3e3783d2dd7a1b (patch)
tree2d100c2307313118f62ae83634a3f23046fa1a90 /net/ipv6/ip6_checksum.c
parentda27988766e338e4a4fe198170497c0920395d4c (diff)
downloadlinux-15f35d49c93f4fa9875235e7bf3e3783d2dd7a1b.tar.gz
linux-15f35d49c93f4fa9875235e7bf3e3783d2dd7a1b.tar.bz2
linux-15f35d49c93f4fa9875235e7bf3e3783d2dd7a1b.zip
udplite: fix partial checksum initialization
Since UDP-Lite is always using checksum, the following path is triggered when calculating pseudo header for it: udp4_csum_init() or udp6_csum_init() skb_checksum_init_zero_check() __skb_checksum_validate_complete() The problem can appear if skb->len is less than CHECKSUM_BREAK. In this particular case __skb_checksum_validate_complete() also invokes __skb_checksum_complete(skb). If UDP-Lite is using partial checksum that covers only part of a packet, the function will return bad checksum and the packet will be dropped. It can be fixed if we skip skb_checksum_init_zero_check() and only set the required pseudo header checksum for UDP-Lite with partial checksum before udp4_csum_init()/udp6_csum_init() functions return. Fixes: ed70fcfcee95 ("net: Call skb_checksum_init in IPv4") Fixes: e4f45b7f40bd ("net: Call skb_checksum_init in IPv6") Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_checksum.c')
-rw-r--r--net/ipv6/ip6_checksum.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv6/ip6_checksum.c b/net/ipv6/ip6_checksum.c
index ec43d18b5ff9..547515e8450a 100644
--- a/net/ipv6/ip6_checksum.c
+++ b/net/ipv6/ip6_checksum.c
@@ -73,6 +73,11 @@ int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto)
err = udplite_checksum_init(skb, uh);
if (err)
return err;
+
+ if (UDP_SKB_CB(skb)->partial_cov) {
+ skb->csum = ip6_compute_pseudo(skb, proto);
+ return 0;
+ }
}
/* To support RFC 6936 (allow zero checksum in UDP/IPV6 for tunnels)