net: Move skb_has_shared_frag check out of GRE code and into segmentation
authorAlexander Duyck <aduyck@mirantis.com>
Fri, 5 Feb 2016 23:27:55 +0000 (15:27 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Feb 2016 13:55:34 +0000 (08:55 -0500)
The call skb_has_shared_frag is used in the GRE path and skb_checksum_help
to verify that no frags can be modified by an external entity.  This check
really doesn't belong in the GRE path but in the skb_segment function
itself.  This way any protocol that might be segmented will be performing
this check before attempting to offload a checksum to software.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Acked-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/skbuff.c
net/ipv4/gre_offload.c

index 9c065ac72e873945f655461517454d19cb477673..88262c82b96a5a54c1908b5a6420d76afb0b4552 100644 (file)
@@ -3173,6 +3173,11 @@ skip_fraglist:
 
 perform_csum_check:
                if (!csum) {
+                       if (skb_has_shared_frag(nskb)) {
+                               err = __skb_linearize(nskb);
+                               if (err)
+                                       goto err;
+                       }
                        if (!nskb->remcsum_offload)
                                nskb->ip_summed = CHECKSUM_NONE;
                        SKB_GSO_CB(nskb)->csum =
index 02cb1a416c7d347b16f00137a7724bde0a995be2..35a8dd35ed4e91c34e7f87b9200b628bd523d96c 100644 (file)
@@ -83,17 +83,6 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
                if (csum) {
                        __be32 *pcsum;
 
-                       if (skb_has_shared_frag(skb)) {
-                               int err;
-
-                               err = __skb_linearize(skb);
-                               if (err) {
-                                       kfree_skb_list(segs);
-                                       segs = ERR_PTR(err);
-                                       goto out;
-                               }
-                       }
-
                        skb_reset_transport_header(skb);
 
                        greh = (struct gre_base_hdr *)