diff options
author | Eric Dumazet <edumazet@google.com> | 2012-04-29 05:08:22 -0400 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2012-05-25 12:24:44 -0400 |
commit | 267f095486dd0eca48facb2bf795b54bd11e9eaf (patch) | |
tree | 441f532b4888125c61913e745cefaf4df3235db5 | |
parent | 810b0ae772d97a16d3d08728f1fdb0f6d5f99280 (diff) |
netem: fix possible skb leak
BugLink: http://bugs.launchpad.net/bugs/1002880
[ 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: Tim Gardner <tim.gardner@canonical.com>
-rw-r--r-- | net/sched/sch_netem.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 2f684593f35..945f3dd6c6f 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -350,10 +350,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
350 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { | 350 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { |
351 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || | 351 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || |
352 | (skb->ip_summed == CHECKSUM_PARTIAL && | 352 | (skb->ip_summed == CHECKSUM_PARTIAL && |
353 | skb_checksum_help(skb))) { | 353 | skb_checksum_help(skb))) |
354 | sch->qstats.drops++; | 354 | return qdisc_drop(skb, sch); |
355 | return NET_XMIT_DROP; | ||
356 | } | ||
357 | 355 | ||
358 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); | 356 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); |
359 | } | 357 | } |