Skip to content

Commit 8cc6251

Browse files
jpirkodavem330
authored andcommitted
net: sched: cls_cgroup: no need to call tcf_exts_change for newly allocated struct
As the new struct just was allocated, so 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 6839da3 commit 8cc6251

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

net/sched/cls_cgroup.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
7676
struct nlattr *tb[TCA_CGROUP_MAX + 1];
7777
struct cls_cgroup_head *head = rtnl_dereference(tp->root);
7878
struct cls_cgroup_head *new;
79-
struct tcf_exts e;
8079
int err;
8180

8281
if (!tca[TCA_OPTIONS])
@@ -102,22 +101,13 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
102101
if (err < 0)
103102
goto errout;
104103

105-
err = tcf_exts_init(&e, TCA_CGROUP_ACT, TCA_CGROUP_POLICE);
104+
err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &new->exts, ovr);
106105
if (err < 0)
107106
goto errout;
108-
err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, ovr);
109-
if (err < 0) {
110-
tcf_exts_destroy(&e);
111-
goto errout;
112-
}
113107

114108
err = tcf_em_tree_validate(tp, tb[TCA_CGROUP_EMATCHES], &new->ematches);
115-
if (err < 0) {
116-
tcf_exts_destroy(&e);
109+
if (err < 0)
117110
goto errout;
118-
}
119-
120-
tcf_exts_change(tp, &new->exts, &e);
121111

122112
rcu_assign_pointer(tp->root, new);
123113
if (head)

0 commit comments

Comments
 (0)