Skip to content

Commit

Permalink
[NET_SCHED]: sch_htb/sch_hfsc: fix oops in qlen_notify
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Mar 27, 2007
1 parent 9b2f7bc commit c38c83c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion net/sched/sch_hfsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c38c83c

Please sign in to comment.