Commit ddff00d4 authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller

net: Move skb_has_shared_frag check out of GRE code and into segmentation

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: default avatarAlexander Duyck <aduyck@mirantis.com>
Acked-by: default avatarTom Herbert <tom@herbertland.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 08b64fcc
...@@ -3173,6 +3173,11 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, ...@@ -3173,6 +3173,11 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
perform_csum_check: perform_csum_check:
if (!csum) { if (!csum) {
if (skb_has_shared_frag(nskb)) {
err = __skb_linearize(nskb);
if (err)
goto err;
}
if (!nskb->remcsum_offload) if (!nskb->remcsum_offload)
nskb->ip_summed = CHECKSUM_NONE; nskb->ip_summed = CHECKSUM_NONE;
SKB_GSO_CB(nskb)->csum = SKB_GSO_CB(nskb)->csum =
......
...@@ -83,17 +83,6 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, ...@@ -83,17 +83,6 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
if (csum) { if (csum) {
__be32 *pcsum; __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); skb_reset_transport_header(skb);
greh = (struct gre_base_hdr *) greh = (struct gre_base_hdr *)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment