Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730488

[PATCH] datapath: Fix an error handling path in 'ovs_nla_init_match_and_action()'

From Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Newsgroups linux.kernel
Subject [PATCH] datapath: Fix an error handling path in 'ovs_nla_init_match_and_action()'
Date 2017-09-11 21:30 +0200
Message-ID <uoCz7-7At-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


All other error handling paths in this function go through the 'error'
label. This one should do the same.

Fixes: 9cc9a5cb176c ("datapath: Avoid using stack larger than 1024.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
I think that the comment above the function could be improved. It looks
like the commit log which has introduced this function.

I'm also not sure that commit 9cc9a5cb176c is of any help. It is
supposed to remove a warning, and I guess it does. But 'ovs_nla_init_match_and_action()'
is called unconditionnaly from 'ovs_flow_cmd_set()'. So even if the stack
used by each function is reduced, the overall stack should be the same, if
not larger.

So this commit sounds like adding a bug where the code was fine and states
to fix an issue but, at the best, only hides it.

Instead of fixing the code with the proposed patch, reverting the initial
commit could also be considered.
---
 net/openvswitch/datapath.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 76cf273a56c7..c3aec6227c91 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1112,7 +1112,8 @@ static int ovs_nla_init_match_and_action(struct net *net,
 		if (!a[OVS_FLOW_ATTR_KEY]) {
 			OVS_NLERR(log,
 				  "Flow key attribute not present in set flow.");
-			return -EINVAL;
+			error = -EINVAL;
+			goto error;
 		}
 
 		*acts = get_flow_actions(net, a[OVS_FLOW_ATTR_ACTIONS], key,
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] datapath: Fix an error handling path in 'ovs_nla_init_match_and_action()' Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-09-11 21:30 +0200
  Re: [PATCH] datapath: Fix an error handling path in  'ovs_nla_init_match_and_action()' David Miller <davem@davemloft.net> - 2017-09-11 21:40 +0200
  Re: [PATCH] datapath: Fix an error handling path in  'ovs_nla_init_match_and_action()' Greg Rose <gvrose8192@gmail.com> - 2017-09-13 00:50 +0200
  Re: [PATCH] datapath: Fix an error handling path in 'ovs_nla_init_match_and_action()' Tonghao Zhang <xiangxia.m.yue@gmail.com> - 2017-09-13 03:00 +0200

csiph-web