diff options
author | Cong Wang <xiyou.wangcong@gmail.com> | 2017-10-26 21:24:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-29 09:49:31 -0400 |
commit | c2f3f31d402be4849b06282c3a5278f2865c9fcc (patch) | |
tree | 07fa419d5a5372c2b430320e787b185d8b75ed23 /net/sched/cls_route.c | |
parent | c0d378ef1266546a39f2df00a56ff1f74166a2b7 (diff) |
net_sched: use tcf_queue_work() in route filter
Defer the tcf_exts_destroy() in RCU callback to
tc filter workqueue and get RTNL lock.
Reported-by: Chris Mi <chrism@mellanox.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_route.c')
-rw-r--r-- | net/sched/cls_route.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 9ddde65915d2..4b14ccd8b8f2 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -57,7 +57,10 @@ struct route4_filter { | |||
57 | u32 handle; | 57 | u32 handle; |
58 | struct route4_bucket *bkt; | 58 | struct route4_bucket *bkt; |
59 | struct tcf_proto *tp; | 59 | struct tcf_proto *tp; |
60 | struct rcu_head rcu; | 60 | union { |
61 | struct work_struct work; | ||
62 | struct rcu_head rcu; | ||
63 | }; | ||
61 | }; | 64 | }; |
62 | 65 | ||
63 | #define ROUTE4_FAILURE ((struct route4_filter *)(-1L)) | 66 | #define ROUTE4_FAILURE ((struct route4_filter *)(-1L)) |
@@ -254,12 +257,22 @@ static int route4_init(struct tcf_proto *tp) | |||
254 | return 0; | 257 | return 0; |
255 | } | 258 | } |
256 | 259 | ||
257 | static void route4_delete_filter(struct rcu_head *head) | 260 | static void route4_delete_filter_work(struct work_struct *work) |
258 | { | 261 | { |
259 | struct route4_filter *f = container_of(head, struct route4_filter, rcu); | 262 | struct route4_filter *f = container_of(work, struct route4_filter, work); |
260 | 263 | ||
264 | rtnl_lock(); | ||
261 | tcf_exts_destroy(&f->exts); | 265 | tcf_exts_destroy(&f->exts); |
262 | kfree(f); | 266 | kfree(f); |
267 | rtnl_unlock(); | ||
268 | } | ||
269 | |||
270 | static void route4_delete_filter(struct rcu_head *head) | ||
271 | { | ||
272 | struct route4_filter *f = container_of(head, struct route4_filter, rcu); | ||
273 | |||
274 | INIT_WORK(&f->work, route4_delete_filter_work); | ||
275 | tcf_queue_work(&f->work); | ||
263 | } | 276 | } |
264 | 277 | ||
265 | static void route4_destroy(struct tcf_proto *tp) | 278 | static void route4_destroy(struct tcf_proto *tp) |