From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1EC63A0524 for ; Thu, 4 Feb 2021 12:37:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 100F124076E; Thu, 4 Feb 2021 12:37:47 +0100 (CET) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id CA68924075E for ; Thu, 4 Feb 2021 12:37:45 +0100 (CET) Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l7cxF-0005gl-L6; Thu, 04 Feb 2021 11:37:45 +0000 From: Christian Ehrhardt To: Shiri Kuzin Cc: Matan Azrad , dpdk stable Date: Thu, 4 Feb 2021 12:29:22 +0100 Message-Id: <20210204112954.2488123-107-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204112954.2488123-1-christian.ehrhardt@canonical.com> References: <20210204112954.2488123-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: refuse empty VLAN in flow pattern' has been queued to stable release 19.11.7 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.7 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/06/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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/324d37cda78779422cfd5193d96944f7ca2f56eb Thanks. Christian Ehrhardt --- >From 324d37cda78779422cfd5193d96944f7ca2f56eb Mon Sep 17 00:00:00 2001 From: Shiri Kuzin 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 Acked-by: Matan Azrad --- 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 0c5e56e409..a670c5f3c5 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -1061,6 +1061,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; @@ -1088,6 +1089,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; @@ -1113,6 +1116,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(items, item_flags, @@ -1217,6 +1221,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.30.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-04 12:04:32.434577808 +0100 +++ 0107-net-mlx5-refuse-empty-VLAN-in-flow-pattern.patch 2021-02-04 12:04:28.130789826 +0100 @@ -1 +1 @@ -From b6aaaa22aeb66cda787d0e0280742da3d735def3 Mon Sep 17 00:00:00 2001 +From 324d37cda78779422cfd5193d96944f7ca2f56eb Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b6aaaa22aeb66cda787d0e0280742da3d735def3 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 205b05783c..b442b9b91c 100644 +index 0c5e56e409..a670c5f3c5 100644 @@ -29 +30 @@ -@@ -1256,6 +1256,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, +@@ -1061,6 +1061,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, @@ -37 +38 @@ -@@ -1283,6 +1284,8 @@ flow_verbs_validate(struct rte_eth_dev *dev, +@@ -1088,6 +1089,8 @@ flow_verbs_validate(struct rte_eth_dev *dev, @@ -46 +47 @@ -@@ -1308,6 +1311,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, +@@ -1113,6 +1116,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, @@ -53,2 +54,2 @@ - ret = mlx5_flow_validate_item_ipv4 -@@ -1419,6 +1423,10 @@ flow_verbs_validate(struct rte_eth_dev *dev, + ret = mlx5_flow_validate_item_ipv4(items, item_flags, +@@ -1217,6 +1221,10 @@ flow_verbs_validate(struct rte_eth_dev *dev,