Skip to content

Commit

Permalink
net/sched: act_ife: preserve the action control in case of error
Browse files Browse the repository at this point in the history
in the following script

 # tc actions add action ife encode allow prio pass index 42
 # tc actions replace action ife encode allow tcindex drop index 42

the action control should remain equal to 'pass', if the kernel failed
to replace the TC action. Pospone the assignment of the action control,
to ensure it is not overwritten in the error path of tcf_ife_init().

Fixes: ef6980b ("introduce IFE action")
Signed-off-by: Davide Caratti <[email protected]>
Acked-by: Cong Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
dcaratti authored and davem330 committed Jun 20, 2018
1 parent 0a889b9 commit cbf56c2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/sched/act_ife.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,6 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
saddr = nla_data(tb[TCA_IFE_SMAC]);
}

ife->tcf_action = parm->action;

if (parm->flags & IFE_ENCODE) {
if (daddr)
ether_addr_copy(p->eth_dst, daddr);
Expand Down Expand Up @@ -575,6 +573,7 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
}
}

ife->tcf_action = parm->action;
if (exists)
spin_unlock_bh(&ife->tcf_lock);

Expand Down

0 comments on commit cbf56c2

Please sign in to comment.