summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2014-09-19 16:04:38 +0800
committerDavid S. Miller <davem@davemloft.net>2014-09-22 14:57:08 -0400
commitcecda693a969816bac5e470e1d9c9c0ef5567bca (patch)
treeddc86a719057aeeec4616b4a3d762418c11ea3e9 /net/core
parentb749fc9bff50013182edf2371d7f6c6796aed808 (diff)
downloadop-kernel-dev-cecda693a969816bac5e470e1d9c9c0ef5567bca.zip
op-kernel-dev-cecda693a969816bac5e470e1d9c9c0ef5567bca.tar.gz
net: keep original skb which only needs header checking during software GSO
Commit ce93718fb7cdbc064c3000ff59e4d3200bdfa744 ("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 ce93718fb7cdbc064c3000ff59e4d3200bdfa744 ("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>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index e916ba8..52cd71a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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))
OpenPOWER on IntegriCloud