Skip to content

Commit

Permalink
net: Move skb_has_shared_frag check out of GRE code and into segmenta…
Browse files Browse the repository at this point in the history
…tion

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 <[email protected]>
Acked-by: Tom Herbert <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Alexander Duyck authored and davem330 committed Feb 11, 2016
1 parent 08b64fc commit ddff00d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
5 changes: 5 additions & 0 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -3173,6 +3173,11 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,

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 =
Expand Down
11 changes: 0 additions & 11 deletions net/ipv4/gre_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
Expand Down

0 comments on commit ddff00d

Please sign in to comment.