diff options
author | Vlad Buslov <vladbu@mellanox.com> | 2018-09-19 16:37:29 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-21 08:55:05 -0700 |
commit | ec3ed293e76656c1fb5388249e1e61c7d274abfc (patch) | |
tree | 604673128c39e122b387ecee8db0ad222eb4152d /net/sched/cls_flower.c | |
parent | 947e326c45dff8010a03db54a81c2068e6c28941 (diff) | |
download | linux-stable-ec3ed293e76656c1fb5388249e1e61c7d274abfc.tar.gz linux-stable-ec3ed293e76656c1fb5388249e1e61c7d274abfc.tar.bz2 linux-stable-ec3ed293e76656c1fb5388249e1e61c7d274abfc.zip |
net_sched: change tcf_del_walker() to take idrinfo->lock
Action API was changed to work with actions and action_idr in concurrency
safe manner, however tcf_del_walker() still uses actions without taking a
reference or idrinfo->lock first, and deletes them directly, disregarding
possible concurrent delete.
Change tcf_del_walker() to take idrinfo->lock while iterating over actions
and use new tcf_idr_release_unsafe() to release them while holding the
lock.
And the blocking function fl_hw_destroy_tmplt() could be called when we
put a filter chain, so defer it to a work queue.
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
[xiyou.wangcong@gmail.com: heavily modify the code and changelog]
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_flower.c')
-rw-r--r-- | net/sched/cls_flower.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 9aada2d0ef06..92dd5071a708 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -79,6 +79,7 @@ struct fl_flow_tmplt { struct fl_flow_key mask; struct flow_dissector dissector; struct tcf_chain *chain; + struct rcu_work rwork; }; struct cls_fl_head { @@ -1437,14 +1438,22 @@ errout_tb: return ERR_PTR(err); } -static void fl_tmplt_destroy(void *tmplt_priv) +static void fl_tmplt_destroy_work(struct work_struct *work) { - struct fl_flow_tmplt *tmplt = tmplt_priv; + struct fl_flow_tmplt *tmplt = container_of(to_rcu_work(work), + struct fl_flow_tmplt, rwork); fl_hw_destroy_tmplt(tmplt->chain, tmplt); kfree(tmplt); } +static void fl_tmplt_destroy(void *tmplt_priv) +{ + struct fl_flow_tmplt *tmplt = tmplt_priv; + + tcf_queue_work(&tmplt->rwork, fl_tmplt_destroy_work); +} + static int fl_dump_key_val(struct sk_buff *skb, void *val, int val_type, void *mask, int mask_type, int len) |