aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_nat.c
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2020-09-22 20:56:23 -0700
committerDavid S. Miller <davem@davemloft.net>2020-09-24 19:46:21 -0700
commite49d8c22f1261c43a986a7fdbf677ac309682a07 (patch)
tree83b54bf6cd0eb7356401571e0ff6533fd2bfffda /net/sched/act_nat.c
parentnet: stmmac: removed enabling eee in EEE set callback (diff)
downloadlinux-dev-e49d8c22f1261c43a986a7fdbf677ac309682a07.tar.xz
linux-dev-e49d8c22f1261c43a986a7fdbf677ac309682a07.zip
net_sched: defer tcf_idr_insert() in tcf_action_init_1()
All TC actions call tcf_idr_insert() for new action at the end of their ->init(), so we can actually move it to a central place in tcf_action_init_1(). And once the action is inserted into the global IDR, other parallel process could free it immediately as its refcnt is still 1, so we can not fail after this, we need to move it after the goto action validation to avoid handling the failure case after insertion. This is found during code review, is not directly triggered by syzbot. And this prepares for the next patch. Cc: Vlad Buslov <vladbu@mellanox.com> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_nat.c')
-rw-r--r--net/sched/act_nat.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 855a6fa16a62..1ebd2a86d980 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -93,9 +93,6 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est,
if (goto_ch)
tcf_chain_put_by_act(goto_ch);
- if (ret == ACT_P_CREATED)
- tcf_idr_insert(tn, *a);
-
return ret;
release_idr:
tcf_idr_release(*a, bind);