patch 'net/mlx5: fix write-after-read in flow modify action' has been queued to stable release 24.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Nov 16 23:52:12 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/18/26. 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/5408e49a374f47c1e8f5e452c977e317f163c3b1

Thanks.

Luca Boccassi

---
>From 5408e49a374f47c1e8f5e452c977e317f163c3b1 Mon Sep 17 00:00:00 2001
From: Maayan Kashani <mkashani at nvidia.com>
Date: Mon, 9 Nov 2026 14:50:34 +0200
Subject: [PATCH] net/mlx5: fix write-after-read in flow modify action

[ upstream commit f50df3cbcf8fdb060748209eadae2225bdd56a68 ]

In HWS non-root groups, modify field actions are compiled into a
modify header pattern. When a COPY or ADD_FIELD reads a field and the
next SET or ADD writes that same field, no NOP was inserted between
them. Firmware rejects the resulting pattern at template table
creation with syndrome 0xa0a3a8.

flow_hw_should_insert_nop() only compared the new command's
destination with the previous command's destination. After a
COPY or ADD_FIELD it never compared against the previous source
field, which is the one that was read.

Extend the checks so a NOP is inserted when:
- a SET or ADD writes a field read by the previous COPY or ADD_FIELD,
- a COPY or ADD_FIELD writes a field read by the previous COPY or
  ADD_FIELD.

Two consecutive reads of the same field still do not need a NOP.

Fixes: 0f4aa72b99da ("net/mlx5: support flow modify field with HWS")

Signed-off-by: Maayan Kashani <mkashani at nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index b11fe683b9..7cebc4a473 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -1427,7 +1427,8 @@ flow_hw_should_insert_nop(const struct mlx5_hw_modify_header_action *mhdr,
 			should_insert = new_cmd.field == last_cmd.field;
 		else if (last_type == MLX5_MODIFICATION_TYPE_COPY ||
 			 last_type == MLX5_MODIFICATION_TYPE_ADD_FIELD)
-			should_insert = new_cmd.field == last_cmd.dst_field;
+			should_insert = (new_cmd.field == last_cmd.dst_field ||
+					 new_cmd.field == last_cmd.field);
 		else if (last_type == MLX5_MODIFICATION_TYPE_NOP)
 			should_insert = false;
 		else
@@ -1442,7 +1443,8 @@ flow_hw_should_insert_nop(const struct mlx5_hw_modify_header_action *mhdr,
 		else if (last_type == MLX5_MODIFICATION_TYPE_COPY ||
 			 last_type == MLX5_MODIFICATION_TYPE_ADD_FIELD)
 			should_insert = (new_cmd.field == last_cmd.dst_field ||
-					 new_cmd.dst_field == last_cmd.dst_field);
+					 new_cmd.dst_field == last_cmd.dst_field ||
+					 new_cmd.dst_field == last_cmd.field);
 		else if (last_type == MLX5_MODIFICATION_TYPE_NOP)
 			should_insert = false;
 		else
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-11-16 22:52:18.796468929 +0000
+++ 0058-net-mlx5-fix-write-after-read-in-flow-modify-action.patch	2026-11-16 22:52:16.512234120 +0000
@@ -1 +1 @@
-From f50df3cbcf8fdb060748209eadae2225bdd56a68 Mon Sep 17 00:00:00 2001
+From 5408e49a374f47c1e8f5e452c977e317f163c3b1 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit f50df3cbcf8fdb060748209eadae2225bdd56a68 ]
+
@@ -25 +26,0 @@
-Cc: stable at dpdk.org
@@ -34 +35 @@
-index 1d73324bd2..fe25b9b3ba 100644
+index b11fe683b9..7cebc4a473 100644
@@ -37 +38 @@
-@@ -1572,7 +1572,8 @@ flow_hw_should_insert_nop(const struct mlx5_hw_modify_header_action *mhdr,
+@@ -1427,7 +1427,8 @@ flow_hw_should_insert_nop(const struct mlx5_hw_modify_header_action *mhdr,
@@ -47 +48 @@
-@@ -1587,7 +1588,8 @@ flow_hw_should_insert_nop(const struct mlx5_hw_modify_header_action *mhdr,
+@@ -1442,7 +1443,8 @@ flow_hw_should_insert_nop(const struct mlx5_hw_modify_header_action *mhdr,


More information about the stable mailing list