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: 520ac30f45 ("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>
This commit is contained in:
Eric Dumazet 2016-06-28 10:30:08 +02:00 committed by David S. Miller
parent c973f24d37
commit 8a6e9c6703
1 changed files with 8 additions and 4 deletions

View File

@ -487,10 +487,14 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
skb = segs; skb = segs;
segs = segs->next; segs = segs->next;
if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || skb = skb_unshare(skb, GFP_ATOMIC);
(skb->ip_summed == CHECKSUM_PARTIAL && if (unlikely(!skb)) {
skb_checksum_help(skb))) { qdisc_qstats_drop(sch);
rc = qdisc_drop(skb, sch, to_free); goto finish_segs;
}
if (skb->ip_summed == CHECKSUM_PARTIAL &&
skb_checksum_help(skb)) {
qdisc_drop(skb, sch, to_free);
goto finish_segs; goto finish_segs;
} }