Skip to content

Commit 4097e9d

Browse files
w1ldptrdavem330
authored andcommitted
net: sched: don't use tc_action->order during action dump
Function tcf_action_dump() relies on tc_action->order field when starting nested nla to send action data to userspace. This approach breaks in several cases: - When multiple filters point to same shared action, tc_action->order field is overwritten each time it is attached to filter. This causes filter dump to output action with incorrect attribute for all filters that have the action in different position (different order) from the last set tc_action->order value. - When action data is displayed using tc action API (RTM_GETACTION), action order is overwritten by tca_action_gd() according to its position in resulting array of nl attributes, which will break filter dump for all filters attached to that shared action that expect it to have different order value. Don't rely on tc_action->order when dumping actions. Set nla according to action position in resulting array of actions instead. Signed-off-by: Vlad Buslov <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ab0610e commit 4097e9d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/sched/act_api.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[],
800800

801801
for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) {
802802
a = actions[i];
803-
nest = nla_nest_start_noflag(skb, a->order);
803+
nest = nla_nest_start_noflag(skb, i + 1);
804804
if (nest == NULL)
805805
goto nla_put_failure;
806806
err = tcf_action_dump_1(skb, a, bind, ref);
@@ -1303,7 +1303,6 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n,
13031303
ret = PTR_ERR(act);
13041304
goto err;
13051305
}
1306-
act->order = i;
13071306
attr_size += tcf_action_fill_size(act);
13081307
actions[i - 1] = act;
13091308
}

0 commit comments

Comments
 (0)