diff options
author | Vlad Buslov <vladbu@mellanox.com> | 2020-02-17 13:12:09 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-02-18 01:17:02 +0300 |
commit | 7a47281439ba00b11fc098f36695522184ce5a82 (patch) | |
tree | 1e8992267d2b3ede0f0a436aab381e768cfcb8ce /net/sched/act_sample.c | |
parent | 92df9f8a745ee9b8cc250514272345cb2e74e7ef (diff) | |
download | linux-7a47281439ba00b11fc098f36695522184ce5a82.tar.xz |
net: sched: lock action when translating it to flow_action infra
In order to remove dependency on rtnl lock, take action's tcfa_lock when
constructing its representation as flow_action_entry structure.
Refactor tcf_sample_get_group() to assume that caller holds tcf_lock and
don't take it manually. This callback is only called from flow_action infra
representation translator which now calls it with tcf_lock held, so this
refactoring is necessary to prevent deadlock.
Allocate memory with GFP_ATOMIC flag for ip_tunnel_info copy because
tcf_tunnel_info_copy() is only called from flow_action representation infra
code with tcf_lock spinlock taken.
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_sample.c')
-rw-r--r-- | net/sched/act_sample.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index ce948c1e24dc..5e2df590bb58 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c @@ -267,14 +267,12 @@ tcf_sample_get_group(const struct tc_action *a, struct tcf_sample *s = to_sample(a); struct psample_group *group; - spin_lock_bh(&s->tcf_lock); group = rcu_dereference_protected(s->psample_group, lockdep_is_held(&s->tcf_lock)); if (group) { psample_group_take(group); *destructor = tcf_psample_group_put; } - spin_unlock_bh(&s->tcf_lock); return group; } |