Skip to contentSkip to conversation

net_sched: remove a redundant goto chain check

PATCH Applied Cong Wang 3 participants 3 messages Sep 28, 2020

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 net_sched: remove a redundant goto chain check

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()")
Cc Jamal Hadi Salim <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 net/sched/act_api.c | 14 --------------
 1 file changed, 14 deletions(-)
net/sched/act_api.c +0 -14
index 104b47f5184f..5612b336e18e 100644
@@ -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);
 
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 36 lines · Cong Wang

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()")
Cc Jamal Hadi Salim <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 net/sched/act_api.c | 14 --------------
 1 file changed, 14 deletions(-)
net/sched/act_api.c +0 -7
index 104b47f5184f..5612b336e18e 100644
@@ -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;
 

net/sched/act_api.c struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, · line 998

Quoted 10 lines
net/sched/act_api.c +0 -7
-	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);
 

thanks!

Signature · 1 line
davide
maintainer Applied
#2 lore raw
In reply to Cong Wang

From: Cong Wang <[email protected]>
Date: Mon, 28 Sep 2020 11:31:03 -0700

Quoted 10 lines

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()")
Cc Jamal Hadi Salim <[email protected]>
Cc Jiri Pirko <[email protected]>

Applied, thank you.