Merge tag 'edac_for_4.20_2' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp
[linux-2.6-microblaze.git] / net / ipv6 / ip6_checksum.c
index 547515e..3777170 100644 (file)
@@ -88,8 +88,24 @@ int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto)
         * Note, we are only interested in != 0 or == 0, thus the
         * force to int.
         */
-       return (__force int)skb_checksum_init_zero_check(skb, proto, uh->check,
-                                                        ip6_compute_pseudo);
+       err = (__force int)skb_checksum_init_zero_check(skb, proto, uh->check,
+                                                       ip6_compute_pseudo);
+       if (err)
+               return err;
+
+       if (skb->ip_summed == CHECKSUM_COMPLETE && !skb->csum_valid) {
+               /* If SW calculated the value, we know it's bad */
+               if (skb->csum_complete_sw)
+                       return 1;
+
+               /* HW says the value is bad. Let's validate that.
+                * skb->csum is no longer the full packet checksum,
+                * so don't treat is as such.
+                */
+               skb_checksum_complete_unset(skb);
+       }
+
+       return 0;
 }
 EXPORT_SYMBOL(udp6_csum_init);