* [Patch net] net_sched: remove a redundant goto chain check
@ 2020-09-28 18:31 Cong Wang
2020-09-28 18:56 ` Davide Caratti
2020-09-28 19:59 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Cong Wang @ 2020-09-28 18:31 UTC (permalink / raw)
To: netdev
Cc: Cong Wang, Vlad Buslov, Davide Caratti, Jamal Hadi Salim, Jiri Pirko
All TC actions call tcf_action_check_ctrlact() to validate
goto chain, so this check in tcf_action_init_1() is actually
redundant. Remove it to save troubles of leaking memory.
Fixes: e49d8c22f126 ("net_sched: defer tcf_idr_insert() in tcf_action_init_1()")
Reported-by: Vlad Buslov <vladbu@mellanox.com>
Suggested-by: Davide Caratti <dcaratti@redhat.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/sched/act_api.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 104b47f5184f..5612b336e18e 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -722,13 +722,6 @@ int tcf_action_destroy(struct tc_action *actions[], int bind)
return ret;
}
-static int tcf_action_destroy_1(struct tc_action *a, int bind)
-{
- struct tc_action *actions[] = { a, NULL };
-
- return tcf_action_destroy(actions, bind);
-}
-
static int tcf_action_put(struct tc_action *p)
{
return __tcf_action_put(p, false);
@@ -1000,13 +993,6 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
if (err < 0)
goto err_mod;
- if (TC_ACT_EXT_CMP(a->tcfa_action, TC_ACT_GOTO_CHAIN) &&
- !rcu_access_pointer(a->goto_chain)) {
- tcf_action_destroy_1(a, bind);
- NL_SET_ERR_MSG(extack, "can't use goto chain with NULL chain");
- return ERR_PTR(-EINVAL);
- }
-
if (!name && tb[TCA_ACT_COOKIE])
tcf_set_action_cookie(&a->act_cookie, cookie);
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch net] net_sched: remove a redundant goto chain check
2020-09-28 18:31 [Patch net] net_sched: remove a redundant goto chain check Cong Wang
@ 2020-09-28 18:56 ` Davide Caratti
2020-09-28 19:59 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Davide Caratti @ 2020-09-28 18:56 UTC (permalink / raw)
To: Cong Wang, netdev; +Cc: Vlad Buslov, Jamal Hadi Salim, Jiri Pirko
On Mon, 2020-09-28 at 11:31 -0700, Cong Wang wrote:
> All TC actions call tcf_action_check_ctrlact() to validate
> goto chain, so this check in tcf_action_init_1() is actually
> redundant. Remove it to save troubles of leaking memory.
>
> Fixes: e49d8c22f126 ("net_sched: defer tcf_idr_insert() in tcf_action_init_1()")
> Reported-by: Vlad Buslov <vladbu@mellanox.com>
> Suggested-by: Davide Caratti <dcaratti@redhat.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Cc: Jiri Pirko <jiri@resnulli.us>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
> net/sched/act_api.c | 14 --------------
> 1 file changed, 14 deletions(-)
>
> diff --git a/net/sched/act_api.c b/net/sched/act_api.c
> index 104b47f5184f..5612b336e18e 100644
> --- a/net/sched/act_api.c
> +++ b/net/sched/act_api.c
> @@ -722,13 +722,6 @@ int tcf_action_destroy(struct tc_action *actions[], int bind)
> return ret;
> }
>
> -static int tcf_action_destroy_1(struct tc_action *a, int bind)
> -{
> - struct tc_action *actions[] = { a, NULL };
> -
> - return tcf_action_destroy(actions, bind);
> -}
> -
> static int tcf_action_put(struct tc_action *p)
> {
> return __tcf_action_put(p, false);
> @@ -1000,13 +993,6 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
> if (err < 0)
> goto err_mod;
>
> - if (TC_ACT_EXT_CMP(a->tcfa_action, TC_ACT_GOTO_CHAIN) &&
> - !rcu_access_pointer(a->goto_chain)) {
> - tcf_action_destroy_1(a, bind);
> - NL_SET_ERR_MSG(extack, "can't use goto chain with NULL chain");
> - return ERR_PTR(-EINVAL);
> - }
> -
> if (!name && tb[TCA_ACT_COOKIE])
> tcf_set_action_cookie(&a->act_cookie, cookie);
>
Reviewed-by: Davide Caratti <dcaratti@redhat.com>
thanks!
--
davide
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch net] net_sched: remove a redundant goto chain check
2020-09-28 18:31 [Patch net] net_sched: remove a redundant goto chain check Cong Wang
2020-09-28 18:56 ` Davide Caratti
@ 2020-09-28 19:59 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-09-28 19:59 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, vladbu, dcaratti, jhs, jiri
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 28 Sep 2020 11:31:03 -0700
> All TC actions call tcf_action_check_ctrlact() to validate
> goto chain, so this check in tcf_action_init_1() is actually
> redundant. Remove it to save troubles of leaking memory.
>
> Fixes: e49d8c22f126 ("net_sched: defer tcf_idr_insert() in tcf_action_init_1()")
> Reported-by: Vlad Buslov <vladbu@mellanox.com>
> Suggested-by: Davide Caratti <dcaratti@redhat.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Cc: Jiri Pirko <jiri@resnulli.us>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-28 19:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 18:31 [Patch net] net_sched: remove a redundant goto chain check Cong Wang
2020-09-28 18:56 ` Davide Caratti
2020-09-28 19:59 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).