# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/08/22 14:37:58+02:00 kaber@coreworks.de # [PKT_SCHED]: Fix class leak in CBQ scheduler # # Signed-off-by: Patrick McHardy # # net/sched/sch_cbq.c # 2004/08/22 14:37:27+02:00 kaber@coreworks.de +8 -6 # [PKT_SCHED]: Fix class leak in CBQ scheduler # diff -Nru a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c --- a/net/sched/sch_cbq.c 2004-08-22 14:38:18 +02:00 +++ b/net/sched/sch_cbq.c 2004-08-22 14:38:18 +02:00 @@ -1712,15 +1712,18 @@ } } -static void cbq_destroy_class(struct cbq_class *cl) +static void cbq_destroy_class(struct Qdisc *sch, struct cbq_class *cl) { + struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data; + cbq_destroy_filters(cl); qdisc_destroy(cl->q); qdisc_put_rtab(cl->R_tab); #ifdef CONFIG_NET_ESTIMATOR qdisc_kill_estimator(&cl->stats); #endif - kfree(cl); + if (cl != &q->link) + kfree(cl); } static void @@ -1743,8 +1746,7 @@ for (cl = q->classes[h]; cl; cl = next) { next = cl->next; - if (cl != &q->link) - cbq_destroy_class(cl); + cbq_destroy_class(sch, cl); } } @@ -1766,7 +1768,7 @@ spin_unlock_bh(&sch->dev->queue_lock); #endif - cbq_destroy_class(cl); + cbq_destroy_class(sch, cl); } } @@ -2000,7 +2002,7 @@ sch_tree_unlock(sch); if (--cl->refcnt == 0) - cbq_destroy_class(cl); + cbq_destroy_class(sch, cl); return 0; }