[NET_SCHED]: sch_htb/sch_hfsc: fix oops in qlen_notify
authorPatrick McHardy <kaber@trash.net>
Tue, 27 Mar 2007 21:04:24 +0000 (14:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Mar 2007 21:04:24 +0000 (14:04 -0700)
During both HTB and HFSC class deletion the class is removed from the
class hash before calling qdisc_tree_decrease_qlen. This makes the
->get operation in qdisc_tree_decrease_qlen fail, so it passes a NULL
pointer to ->qlen_notify, causing an oops.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_hfsc.c
net/sched/sch_htb.c

index 396deb71480f5612250e25cc58cc29f7178c4b1c..407c6fb1ba14c501330816258a04440a46bd09a4 100644 (file)
@@ -1184,10 +1184,12 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
 
        sch_tree_lock(sch);
 
-       list_del(&cl->hlist);
        list_del(&cl->siblings);
        hfsc_adjust_levels(cl->cl_parent);
+
        hfsc_purge_queue(sch, cl);
+       list_del(&cl->hlist);
+
        if (--cl->refcnt == 0)
                hfsc_destroy_class(sch, cl);
 
index 97cbb9aec946b56b2e0547206349ec615ec4a876..3c3294d01041743e721d53f0cd5f44be2b039865 100644 (file)
@@ -1380,15 +1380,15 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
 
        sch_tree_lock(sch);
 
-       /* delete from hash and active; remainder in destroy_class */
-       hlist_del_init(&cl->hlist);
-
        if (!cl->level) {
                qlen = cl->un.leaf.q->q.qlen;
                qdisc_reset(cl->un.leaf.q);
                qdisc_tree_decrease_qlen(cl->un.leaf.q, qlen);
        }
 
+       /* delete from hash and active; remainder in destroy_class */
+       hlist_del_init(&cl->hlist);
+
        if (cl->prio_activity)
                htb_deactivate(q, cl);