netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/sched: act_ife: preserve the action control in case of error
@ 2018-06-19 13:45 Davide Caratti
  2018-06-19 19:59 ` Cong Wang
  2018-06-20  0:06 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Davide Caratti @ 2018-06-19 13:45 UTC (permalink / raw)
  To: Jamal Hadi Salim, Cong Wang; +Cc: David S. Miller, netdev

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: ef6980b6becb ("introduce IFE action")
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
 net/sched/act_ife.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 078d52212172..20d7d36b2fc9 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -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);
@@ -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);
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net/sched: act_ife: preserve the action control in case of error
  2018-06-19 13:45 [PATCH net] net/sched: act_ife: preserve the action control in case of error Davide Caratti
@ 2018-06-19 19:59 ` Cong Wang
  2018-06-20  0:06 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Cong Wang @ 2018-06-19 19:59 UTC (permalink / raw)
  To: Davide Caratti
  Cc: Jamal Hadi Salim, David S. Miller,
	Linux Kernel Network Developers

On Tue, Jun 19, 2018 at 6:45 AM, Davide Caratti <dcaratti@redhat.com> wrote:
> 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: ef6980b6becb ("introduce IFE action")
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>

Acked-by: Cong Wang <xiyou.wangcong@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net/sched: act_ife: preserve the action control in case of error
  2018-06-19 13:45 [PATCH net] net/sched: act_ife: preserve the action control in case of error Davide Caratti
  2018-06-19 19:59 ` Cong Wang
@ 2018-06-20  0:06 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-06-20  0:06 UTC (permalink / raw)
  To: dcaratti; +Cc: jhs, xiyou.wangcong, netdev

From: Davide Caratti <dcaratti@redhat.com>
Date: Tue, 19 Jun 2018 15:45:50 +0200

> 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: ef6980b6becb ("introduce IFE action")
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-20  0:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-19 13:45 [PATCH net] net/sched: act_ife: preserve the action control in case of error Davide Caratti
2018-06-19 19:59 ` Cong Wang
2018-06-20  0:06 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).