net_sched: fix a use-after-free in sfq
authorWANG Cong <[email protected]>
Tue, 14 Jul 2015 18:21:57 +0000 (11:21 -0700)
committerDavid S. Miller <[email protected]>
Thu, 16 Jul 2015 04:36:34 +0000 (21:36 -0700)
Fixes: 25331d6ce42b ("net: sched: implement qstat helper routines")
Cc: John Fastabend <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/sched/sch_sfq.c

index 7d14926633601b85c2d281d914fa978c8a038e10..52f75a5473e120f8d0a02a2ff1c0215ff02437b5 100644 (file)
@@ -306,10 +306,10 @@ drop:
                len = qdisc_pkt_len(skb);
                slot->backlog -= len;
                sfq_dec(q, x);
-               kfree_skb(skb);
                sch->q.qlen--;
                qdisc_qstats_drop(sch);
                qdisc_qstats_backlog_dec(sch, skb);
+               kfree_skb(skb);
                return len;
        }