diff options
author | Eric Dumazet <edumazet@google.com> | 2016-06-28 10:30:08 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-29 08:02:24 -0400 |
commit | 8a6e9c670341db1ee913e3888cb44a08f18e7489 (patch) | |
tree | a4a4a86b0f7c5e9df8b6e50197b2f62496a80ffe /net/sched/sch_netem.c | |
parent | c973f24d370c919d357e45e9c6ca69a0717d81b7 (diff) | |
download | linux-8a6e9c670341db1ee913e3888cb44a08f18e7489.tar.gz linux-8a6e9c670341db1ee913e3888cb44a08f18e7489.tar.bz2 linux-8a6e9c670341db1ee913e3888cb44a08f18e7489.zip |
net_sched: netem: do not call qdisc_drop() with a NULL skb
If skb_unshare() fails, we call qdisc_drop() with a NULL skb, which
is no longer supported.
Fixes: 520ac30f4551 ("net_sched: drop packets after root qdisc lock is released")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_netem.c')
-rw-r--r-- | net/sched/sch_netem.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index ccca8ca4c722..6eac3d880048 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -487,10 +487,14 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, skb = segs; segs = segs->next; - if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || - (skb->ip_summed == CHECKSUM_PARTIAL && - skb_checksum_help(skb))) { - rc = qdisc_drop(skb, sch, to_free); + skb = skb_unshare(skb, GFP_ATOMIC); + if (unlikely(!skb)) { + qdisc_qstats_drop(sch); + goto finish_segs; + } + if (skb->ip_summed == CHECKSUM_PARTIAL && + skb_checksum_help(skb)) { + qdisc_drop(skb, sch, to_free); goto finish_segs; } |