Skip to contentSkip to conversation

openvswitch: Fix push/pop ethernet validation

PATCH In review Jaime Caamaño Ruiz 3 participants 3 messages Nov 1, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openvswitch: Fix push/pop ethernet validation

When there are both pop and push ethernet header actions among the actions to be applied to a packet, an unexpected EINVAL (Invalid argument) error is obtained. This is due to mac_proto not being reset correctly when those actions are validated.

Reported-at:
https://mail.openvswitch.org/pipermail/ovs-discuss/2018-October/047554.html

Fixes 91820da6ae85 ("openvswitch: add Ethernet push and pop actions")
---
 net/openvswitch/flow_netlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/openvswitch/flow_netlink.c +2 -2
index a70097ecf33c..865ecef68196 100644
@@ -3030,7 +3030,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
 			 * is already present */
 			if (mac_proto != MAC_PROTO_NONE)
 				return -EINVAL;
-			mac_proto = MAC_PROTO_NONE;
+			mac_proto = MAC_PROTO_ETHERNET;
 			break;
 
 		case OVS_ACTION_ATTR_POP_ETH:
@@ -3038,7 +3038,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
 				return -EINVAL;
 			if (vlan_tci & htons(VLAN_TAG_PRESENT))
 				return -EINVAL;
-			mac_proto = MAC_PROTO_ETHERNET;
+			mac_proto = MAC_PROTO_NONE;
 			break;
 
 		case OVS_ACTION_ATTR_PUSH_NSH:
Signature · 1 line
2.16.4
Tested-by Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Jaime Caamaño Ruiz

When there are both pop and push ethernet header actions among the actions to be applied to a packet, an unexpected EINVAL (Invalid argument) error is obtained. This is due to mac_proto not being reset correctly when those actions are validated.

Reported-at:
https://mail.openvswitch.org/pipermail/ovs-discuss/2018-October/047554.html

Fixes 91820da6ae85 ("openvswitch: add Ethernet push and pop actions")
---
  net/openvswitch/flow_netlink.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
net/openvswitch/flow_netlink.c +1 -1
index a70097ecf33c..865ecef68196 100644
@@ -3030,7 +3030,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
  			 * is already present */
  			if (mac_proto != MAC_PROTO_NONE)
  				return -EINVAL;
-			mac_proto = MAC_PROTO_NONE;
+			mac_proto = MAC_PROTO_ETHERNET;
  			break;
 
  		case OVS_ACTION_ATTR_POP_ETH:

net/openvswitch/flow_netlink.c static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, · line 3044

Quoted 8 lines
net/openvswitch/flow_netlink.c +1 -1
@@ -3038,7 +3038,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
  				return -EINVAL;
  			if (vlan_tci & htons(VLAN_TAG_PRESENT))
  				return -EINVAL;
-			mac_proto = MAC_PROTO_ETHERNET;
+			mac_proto = MAC_PROTO_NONE;
  			break;
 
  		case OVS_ACTION_ATTR_PUSH_NSH:

Thanks Jaime!

maintainer
#2 lore raw
In reply to Jaime Caamaño Ruiz

From: Jaime Caamaño Ruiz <[email protected]>
Date: Wed, 31 Oct 2018 18:52:03 +0100

Quoted 9 lines

When there are both pop and push ethernet header actions among the actions to be applied to a packet, an unexpected EINVAL (Invalid argument) error is obtained. This is due to mac_proto not being reset correctly when those actions are validated.

Reported-at:
https://mail.openvswitch.org/pipermail/ovs-discuss/2018-October/047554.html

Fixes 91820da6ae85 ("openvswitch: add Ethernet push and pop actions")

Applied and queued up for -stable.