Skip to content

Commit 705c709

Browse files
jpirkodavem330
authored andcommitted
net: sched: cls_u32: no need to call tcf_exts_change for newly allocated struct
As the n struct was allocated right before u32_set_parms call, no need to use tcf_exts_change to do atomic change, and we can just fill-up the unused exts struct directly by tcf_exts_validate. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8c98d57 commit 705c709

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

net/sched/cls_u32.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -723,29 +723,24 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp,
723723
struct tc_u_knode *n, struct nlattr **tb,
724724
struct nlattr *est, bool ovr)
725725
{
726-
struct tcf_exts e;
727726
int err;
728727

729-
err = tcf_exts_init(&e, TCA_U32_ACT, TCA_U32_POLICE);
728+
err = tcf_exts_validate(net, tp, tb, est, &n->exts, ovr);
730729
if (err < 0)
731730
return err;
732-
err = tcf_exts_validate(net, tp, tb, est, &e, ovr);
733-
if (err < 0)
734-
goto errout;
735731

736-
err = -EINVAL;
737732
if (tb[TCA_U32_LINK]) {
738733
u32 handle = nla_get_u32(tb[TCA_U32_LINK]);
739734
struct tc_u_hnode *ht_down = NULL, *ht_old;
740735

741736
if (TC_U32_KEY(handle))
742-
goto errout;
737+
return -EINVAL;
743738

744739
if (handle) {
745740
ht_down = u32_lookup_ht(ht->tp_c, handle);
746741

747742
if (ht_down == NULL)
748-
goto errout;
743+
return -EINVAL;
749744
ht_down->refcnt++;
750745
}
751746

@@ -765,16 +760,11 @@ static int u32_set_parms(struct net *net, struct tcf_proto *tp,
765760
int ret;
766761
ret = tcf_change_indev(net, tb[TCA_U32_INDEV]);
767762
if (ret < 0)
768-
goto errout;
763+
return -EINVAL;
769764
n->ifindex = ret;
770765
}
771766
#endif
772-
tcf_exts_change(tp, &n->exts, &e);
773-
774767
return 0;
775-
errout:
776-
tcf_exts_destroy(&e);
777-
return err;
778768
}
779769

780770
static void u32_replace_knode(struct tcf_proto *tp, struct tc_u_common *tp_c,

0 commit comments

Comments
 (0)