Skip to content

Commit

Permalink
[NET_SCHED]: Fix filter double free
Browse files Browse the repository at this point in the history
cbq and atm destroy their filters twice when destroying inner classes
during qdisc destruction.

Reported-and-tested-by: Strobl Anton <a.strobl@aws-it.at>

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 Jun 7, 2007
1 parent 7c355f5 commit b00b4bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions net/sched/sch_atm.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ static void atm_tc_destroy(struct Qdisc *sch)
/* races ? */
while ((flow = p->flows)) {
tcf_destroy_chain(flow->filter_list);
flow->filter_list = NULL;
if (flow->ref > 1)
printk(KERN_ERR "atm_destroy: %p->ref = %d\n",flow,
flow->ref);
Expand Down
8 changes: 5 additions & 3 deletions net/sched/sch_cbq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1748,10 +1748,12 @@ cbq_destroy(struct Qdisc* sch)
* classes from root to leafs which means that filters can still
* be bound to classes which have been destroyed already. --TGR '04
*/
for (h = 0; h < 16; h++)
for (cl = q->classes[h]; cl; cl = cl->next)
for (h = 0; h < 16; h++) {
for (cl = q->classes[h]; cl; cl = cl->next) {
tcf_destroy_chain(cl->filter_list);

cl->filter_list = NULL;
}
}
for (h = 0; h < 16; h++) {
struct cbq_class *next;

Expand Down

0 comments on commit b00b4bf

Please sign in to comment.