diff options
author | Eric Dumazet <edumazet@google.com> | 2012-04-29 09:08:22 +0000 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2012-10-07 23:37:48 +0200 |
commit | 88a3ee1a9002d52325622008a252bfff3dcfb940 (patch) | |
tree | 346e5bada631cbeb3ff01144b7c11f683a9861ad /net | |
parent | 25849872019de099f8c5e18868f71d031f63dabb (diff) |
netem: fix possible skb leak
[ Upstream commit 116a0fc31c6c9b8fc821be5a96e5bf0b43260131 ]
skb_checksum_help(skb) can return an error, we must free skb in this
case. qdisc_drop(skb, sch) can also be feeded with a NULL skb (if
skb_unshare() failed), so lets use this generic helper.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'net')
-rw-r--r-- | net/sched/sch_netem.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 2b88295cb7b7..0ae345a24888 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -199,12 +199,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) * do it now in software before we mangle it. */ if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { - if (!(skb = skb_unshare(skb, GFP_ATOMIC)) - || (skb->ip_summed == CHECKSUM_PARTIAL - && skb_checksum_help(skb))) { - sch->qstats.drops++; - return NET_XMIT_DROP; - } + if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || + (skb->ip_summed == CHECKSUM_PARTIAL && + skb_checksum_help(skb))) + return qdisc_drop(skb, sch); skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); } |