diff options
Diffstat (limited to 'net/sched/act_api.c')
-rw-r--r-- | net/sched/act_api.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 972378f47f3c..23b25f89e7e0 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -26,6 +26,11 @@ | |||
26 | #include <net/act_api.h> | 26 | #include <net/act_api.h> |
27 | #include <net/netlink.h> | 27 | #include <net/netlink.h> |
28 | 28 | ||
29 | static void tcf_common_free_rcu(struct rcu_head *head) | ||
30 | { | ||
31 | kfree(container_of(head, struct tcf_common, tcfc_rcu)); | ||
32 | } | ||
33 | |||
29 | void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo) | 34 | void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo) |
30 | { | 35 | { |
31 | unsigned int h = tcf_hash(p->tcfc_index, hinfo->hmask); | 36 | unsigned int h = tcf_hash(p->tcfc_index, hinfo->hmask); |
@@ -38,7 +43,11 @@ void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo) | |||
38 | write_unlock_bh(hinfo->lock); | 43 | write_unlock_bh(hinfo->lock); |
39 | gen_kill_estimator(&p->tcfc_bstats, | 44 | gen_kill_estimator(&p->tcfc_bstats, |
40 | &p->tcfc_rate_est); | 45 | &p->tcfc_rate_est); |
41 | kfree(p); | 46 | /* |
47 | * gen_estimator est_timer() might access p->tcfc_lock | ||
48 | * or bstats, wait a RCU grace period before freeing p | ||
49 | */ | ||
50 | call_rcu(&p->tcfc_rcu, tcf_common_free_rcu); | ||
42 | return; | 51 | return; |
43 | } | 52 | } |
44 | } | 53 | } |