Skip to content

Commit

Permalink
net-sched: fix filter destruction in atm/hfsc qdisc destruction
Browse files Browse the repository at this point in the history
Filters need to be destroyed before beginning to destroy classes
since the destination class needs to still be alive to unbind the
filter.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
kaber authored and davem330 committed Jul 2, 2008
1 parent ff31ab5 commit a4aebb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/sched/sch_atm.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,11 @@ static void atm_tc_destroy(struct Qdisc *sch)
struct atm_flow_data *flow;

pr_debug("atm_tc_destroy(sch %p,[qdisc %p])\n", sch, p);
for (flow = p->flows; flow; flow = flow->next)
tcf_destroy_chain(&flow->filter_list);

/* races ? */
while ((flow = p->flows)) {
tcf_destroy_chain(&flow->filter_list);
if (flow->ref > 1)
printk(KERN_ERR "atm_destroy: %p->ref = %d\n", flow,
flow->ref);
Expand Down
4 changes: 4 additions & 0 deletions net/sched/sch_hfsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,10 @@ hfsc_destroy_qdisc(struct Qdisc *sch)
struct hfsc_class *cl, *next;
unsigned int i;

for (i = 0; i < HFSC_HSIZE; i++) {
list_for_each_entry(cl, &q->clhash[i], hlist)
tcf_destroy_chain(&cl->filter_list);
}
for (i = 0; i < HFSC_HSIZE; i++) {
list_for_each_entry_safe(cl, next, &q->clhash[i], hlist)
hfsc_destroy_class(sch, cl);
Expand Down

0 comments on commit a4aebb8

Please sign in to comment.