Commit 1cba75a4 authored by Eric Dumazet's avatar Eric Dumazet Committed by Ben Hutchings

netem: fix a use after free

commit 21de12ee upstream.

If the packet was dropped by lower qdisc, then we must not
access it later.

Save qdisc_pkt_len(skb) in a temp variable.

Fixes: 2ccccf5f ("net_sched: update hierarchical backlog too")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: WANG Cong <xiyou.wangcong@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: not using qdisc_qstats_drop()]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent a64474e6
......@@ -606,14 +606,14 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)
#endif
if (q->qdisc) {
unsigned int pkt_len = qdisc_pkt_len(skb);
int err = qdisc_enqueue(skb, q->qdisc);
if (unlikely(err != NET_XMIT_SUCCESS)) {
if (net_xmit_drop_count(err)) {
if (err != NET_XMIT_SUCCESS &&
net_xmit_drop_count(err)) {
sch->qstats.drops++;
qdisc_tree_reduce_backlog(sch, 1,
qdisc_pkt_len(skb));
}
pkt_len);
}
goto tfifo_dequeue;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment