fq_codel: fix a use-after-free
authorWANG Cong <xiyou.wangcong@gmail.com>
Mon, 13 Jul 2015 19:30:07 +0000 (12:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 16 Jul 2015 00:18:21 +0000 (17:18 -0700)
Fixes: 25331d6ce42b ("net: sched: implement qstat helper routines")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_fq_codel.c

index d75993f89facc0ce8d5df0d26aedcd016714a43e..06e7c845e24d8d52e2d7f38f985a0ad93860cc00 100644 (file)
@@ -155,10 +155,10 @@ static unsigned int fq_codel_drop(struct Qdisc *sch)
        skb = dequeue_head(flow);
        len = qdisc_pkt_len(skb);
        q->backlogs[idx] -= len;
-       kfree_skb(skb);
        sch->q.qlen--;
        qdisc_qstats_drop(sch);
        qdisc_qstats_backlog_dec(sch, skb);
+       kfree_skb(skb);
        flow->dropped++;
        return idx;
 }