patch 'net/mlx5: fix connection tracking action validation' has been queued to stable release 23.11.1

Xueming Li xuemingl at nvidia.com
Sat Apr 13 14:48:54 CEST 2024


Hi,

FYI, your patch has been queued to stable release 23.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 04/15/24. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=527857d5c23773f18c6bc166c227f6ded034d6e2

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 527857d5c23773f18c6bc166c227f6ded034d6e2 Mon Sep 17 00:00:00 2001
From: Dariusz Sosnowski <dsosnowski at nvidia.com>
Date: Tue, 27 Feb 2024 15:52:22 +0200
Subject: [PATCH] net/mlx5: fix connection tracking action validation
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit bd2db022c1ad154cd996b7b858c9f04f5a458416 ]

In mlx5 PMD, handles to indirect connection tracking flow actions
are encoded as 32-bit unsigned integers, where port ID is stored
in bits 28-25. Because of this, connection tracking flow actions
cannot be created on ports with IDs higher than 15.
This patch adds missing validation.

Fixes: 463170a7c934 ("net/mlx5: support connection tracking with HWS")

Signed-off-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
Acked-by: Ori Kam <orika at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 9 +++++++++
 drivers/net/mlx5/mlx5_flow_hw.c | 7 +++++++
 2 files changed, 16 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 79fde3de8e..c0d9e4fb82 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -13629,6 +13629,13 @@ flow_dv_translate_create_conntrack(struct rte_eth_dev *dev,
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
 					  "Connection is not supported");
+	if (dev->data->port_id >= MLX5_INDIRECT_ACT_CT_MAX_PORT) {
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+				   "CT supports port indexes up to "
+				   RTE_STR(MLX5_ACTION_CTX_CT_MAX_PORT));
+		return 0;
+	}
 	idx = flow_dv_aso_ct_alloc(dev, error);
 	if (!idx)
 		return rte_flow_error_set(error, rte_errno,
@@ -16321,6 +16328,8 @@ flow_dv_action_create(struct rte_eth_dev *dev,
 	case RTE_FLOW_ACTION_TYPE_CONNTRACK:
 		ret = flow_dv_translate_create_conntrack(dev, action->conf,
 							 err);
+		if (!ret)
+			break;
 		idx = MLX5_INDIRECT_ACT_CT_GEN_IDX(PORT_ID(priv), ret);
 		break;
 	default:
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index c748e48e31..4927975461 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -9857,6 +9857,13 @@ flow_hw_conntrack_create(struct rte_eth_dev *dev, uint32_t queue,
 				   "CT is not enabled");
 		return 0;
 	}
+	if (dev->data->port_id >= MLX5_INDIRECT_ACT_CT_MAX_PORT) {
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+				   "CT supports port indexes up to "
+				   RTE_STR(MLX5_ACTION_CTX_CT_MAX_PORT));
+		return 0;
+	}
 	ct = mlx5_ipool_zmalloc(pool->cts, &ct_idx);
 	if (!ct) {
 		rte_flow_error_set(error, rte_errno,
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-04-13 20:43:06.700172408 +0800
+++ 0054-net-mlx5-fix-connection-tracking-action-validation.patch	2024-04-13 20:43:04.987753945 +0800
@@ -1 +1 @@
-From bd2db022c1ad154cd996b7b858c9f04f5a458416 Mon Sep 17 00:00:00 2001
+From 527857d5c23773f18c6bc166c227f6ded034d6e2 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit bd2db022c1ad154cd996b7b858c9f04f5a458416 ]
@@ -13 +15,0 @@
-Cc: stable at dpdk.org
@@ -23 +25 @@
-index 75a8a223ab..ddf19e9a51 100644
+index 79fde3de8e..c0d9e4fb82 100644
@@ -26 +28 @@
-@@ -13889,6 +13889,13 @@ flow_dv_translate_create_conntrack(struct rte_eth_dev *dev,
+@@ -13629,6 +13629,13 @@ flow_dv_translate_create_conntrack(struct rte_eth_dev *dev,
@@ -40 +42 @@
-@@ -16586,6 +16593,8 @@ flow_dv_action_create(struct rte_eth_dev *dev,
+@@ -16321,6 +16328,8 @@ flow_dv_action_create(struct rte_eth_dev *dev,
@@ -50 +52 @@
-index c8440262d8..43bde71c93 100644
+index c748e48e31..4927975461 100644
@@ -53 +55 @@
-@@ -10346,6 +10346,13 @@ flow_hw_conntrack_create(struct rte_eth_dev *dev, uint32_t queue,
+@@ -9857,6 +9857,13 @@ flow_hw_conntrack_create(struct rte_eth_dev *dev, uint32_t queue,


More information about the stable mailing list