Commit cecda693 authored by Jason Wang's avatar Jason Wang Committed by David S. Miller

net: keep original skb which only needs header checking during software GSO

Commit ce93718f ("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 ce93718f ("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: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b749fc9b
...@@ -2694,10 +2694,12 @@ struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev) ...@@ -2694,10 +2694,12 @@ struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev)
struct sk_buff *segs; struct sk_buff *segs;
segs = skb_gso_segment(skb, features); segs = skb_gso_segment(skb, features);
kfree_skb(skb); if (IS_ERR(segs)) {
if (IS_ERR(segs))
segs = NULL; segs = NULL;
} else if (segs) {
consume_skb(skb);
skb = segs; skb = segs;
}
} else { } else {
if (skb_needs_linearize(skb, features) && if (skb_needs_linearize(skb, features) &&
__skb_linearize(skb)) __skb_linearize(skb))
......
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