diff options
-rw-r--r-- | net/sched/cls_bpf.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 520c5027646a..037a3ae86829 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -49,7 +49,10 @@ struct cls_bpf_prog { | |||
49 | struct sock_filter *bpf_ops; | 49 | struct sock_filter *bpf_ops; |
50 | const char *bpf_name; | 50 | const char *bpf_name; |
51 | struct tcf_proto *tp; | 51 | struct tcf_proto *tp; |
52 | struct rcu_head rcu; | 52 | union { |
53 | struct work_struct work; | ||
54 | struct rcu_head rcu; | ||
55 | }; | ||
53 | }; | 56 | }; |
54 | 57 | ||
55 | static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = { | 58 | static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = { |
@@ -257,9 +260,21 @@ static void __cls_bpf_delete_prog(struct cls_bpf_prog *prog) | |||
257 | kfree(prog); | 260 | kfree(prog); |
258 | } | 261 | } |
259 | 262 | ||
263 | static void cls_bpf_delete_prog_work(struct work_struct *work) | ||
264 | { | ||
265 | struct cls_bpf_prog *prog = container_of(work, struct cls_bpf_prog, work); | ||
266 | |||
267 | rtnl_lock(); | ||
268 | __cls_bpf_delete_prog(prog); | ||
269 | rtnl_unlock(); | ||
270 | } | ||
271 | |||
260 | static void cls_bpf_delete_prog_rcu(struct rcu_head *rcu) | 272 | static void cls_bpf_delete_prog_rcu(struct rcu_head *rcu) |
261 | { | 273 | { |
262 | __cls_bpf_delete_prog(container_of(rcu, struct cls_bpf_prog, rcu)); | 274 | struct cls_bpf_prog *prog = container_of(rcu, struct cls_bpf_prog, rcu); |
275 | |||
276 | INIT_WORK(&prog->work, cls_bpf_delete_prog_work); | ||
277 | tcf_queue_work(&prog->work); | ||
263 | } | 278 | } |
264 | 279 | ||
265 | static void __cls_bpf_delete(struct tcf_proto *tp, struct cls_bpf_prog *prog) | 280 | static void __cls_bpf_delete(struct tcf_proto *tp, struct cls_bpf_prog *prog) |