Skip to content

Commit

Permalink
net: keep original skb which only needs header checking during softwa…
Browse files Browse the repository at this point in the history
…re GSO

Commit ce93718 ("net: Don't keep
around original SKB when we software segment GSO frames") frees the
original skb after software GSO even for dodgy gso skbs. This breaks
the stream throughput from untrusted sources, since only header
checking was done during software GSO instead of a true
segmentation. This patch fixes this by freeing the original gso skb
only when it was really segmented by software.

Fixes ce93718 ("net: Don't keep
around original SKB when we software segment GSO frames.")

Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jason Wang authored and David S. Miller committed Sep 22, 2014
1 parent b749fc9 commit cecda69
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2694,10 +2694,12 @@ struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev)
struct sk_buff *segs;

segs = skb_gso_segment(skb, features);
kfree_skb(skb);
if (IS_ERR(segs))
if (IS_ERR(segs)) {
segs = NULL;
skb = segs;
} else if (segs) {
consume_skb(skb);
skb = segs;
}
} else {
if (skb_needs_linearize(skb, features) &&
__skb_linearize(skb))
Expand Down

0 comments on commit cecda69

Please sign in to comment.