[dpdk-stable] patch 'net/mlx5: refuse empty VLAN in flow pattern' has been queued to stable release 20.11.1

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Feb 5 12:18:45 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/07/21. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/045b01fde474efc3ccc8bd6818ac4889fa60dc53

Thanks.

Luca Boccassi

---
>From 045b01fde474efc3ccc8bd6818ac4889fa60dc53 Mon Sep 17 00:00:00 2001
From: Shiri Kuzin <shirik at nvidia.com>
Date: Tue, 19 Jan 2021 19:07:00 +0200
Subject: [PATCH] net/mlx5: refuse empty VLAN in flow pattern

[ upstream commit b6aaaa22aeb66cda787d0e0280742da3d735def3 ]

In verbs, an empty VLAN is equivalent to a packet without VLAN layer,
hence, the VLAN item should not be empty and this case is rejected.

However, the case for ether type of VLAN without following VLAN item
was not validated, allowing the creation of a flow with empty
VLAN item.

To fix this issue a validation was added requiring ether type of VLAN
will be followed with VLAN item.

Fixes: 0b1edd21cd78 ("net/mlx5: refuse empty VLAN flow specification")

Signed-off-by: Shiri Kuzin <shirik at nvidia.com>
Acked-by: Matan Azrad <matan at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_verbs.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 59291fbd09..bd060e9d44 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1247,6 +1247,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,
 	uint64_t last_item = 0;
 	uint8_t next_protocol = 0xff;
 	uint16_t ether_type = 0;
+	bool is_empty_vlan = false;
 
 	if (items == NULL)
 		return -1;
@@ -1274,6 +1275,8 @@ flow_verbs_validate(struct rte_eth_dev *dev,
 				ether_type &=
 					((const struct rte_flow_item_eth *)
 					 items->mask)->type;
+				if (ether_type == RTE_BE16(RTE_ETHER_TYPE_VLAN))
+					is_empty_vlan = true;
 				ether_type = rte_be_to_cpu_16(ether_type);
 			} else {
 				ether_type = 0;
@@ -1299,6 +1302,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,
 			} else {
 				ether_type = 0;
 			}
+			is_empty_vlan = false;
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			ret = mlx5_flow_validate_item_ipv4
@@ -1410,6 +1414,10 @@ flow_verbs_validate(struct rte_eth_dev *dev,
 		}
 		item_flags |= last_item;
 	}
+	if (is_empty_vlan)
+		return rte_flow_error_set(error, ENOTSUP,
+						 RTE_FLOW_ERROR_TYPE_ITEM, NULL,
+		    "VLAN matching without vid specification is not supported");
 	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
 		switch (actions->type) {
 		case RTE_FLOW_ACTION_TYPE_VOID:
-- 
2.29.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-02-05 11:18:39.718462322 +0000
+++ 0239-net-mlx5-refuse-empty-VLAN-in-flow-pattern.patch	2021-02-05 11:18:29.238699337 +0000
@@ -1 +1 @@
-From b6aaaa22aeb66cda787d0e0280742da3d735def3 Mon Sep 17 00:00:00 2001
+From 045b01fde474efc3ccc8bd6818ac4889fa60dc53 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit b6aaaa22aeb66cda787d0e0280742da3d735def3 ]
+
@@ -17 +18,0 @@
-Cc: stable at dpdk.org
@@ -26 +27 @@
-index 205b05783c..b442b9b91c 100644
+index 59291fbd09..bd060e9d44 100644
@@ -29 +30 @@
-@@ -1256,6 +1256,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,
+@@ -1247,6 +1247,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,
@@ -37 +38 @@
-@@ -1283,6 +1284,8 @@ flow_verbs_validate(struct rte_eth_dev *dev,
+@@ -1274,6 +1275,8 @@ flow_verbs_validate(struct rte_eth_dev *dev,
@@ -46 +47 @@
-@@ -1308,6 +1311,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,
+@@ -1299,6 +1302,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,
@@ -54 +55 @@
-@@ -1419,6 +1423,10 @@ flow_verbs_validate(struct rte_eth_dev *dev,
+@@ -1410,6 +1414,10 @@ flow_verbs_validate(struct rte_eth_dev *dev,


More information about the stable mailing list