patch 'ethdev: fix flow conversion with null buffer' has been queued to stable release 25.11.5

Kevin Traynor ktraynor at redhat.com
Thu Dec 3 14:04:20 CET 2026


Hi,

FYI, your patch has been queued to stable release 25.11.5

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

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/8c2281b677df0efa990223759ee81a970a7784b4

Thanks.

Kevin

---
>From 8c2281b677df0efa990223759ee81a970a7784b4 Mon Sep 17 00:00:00 2001
From: Anatoly Burakov <anatoly.burakov at intel.com>
Date: Tue, 27 Oct 2026 09:50:08 +0000
Subject: [PATCH] ethdev: fix flow conversion with null buffer

[ upstream commit 2ec9682273db70d75a46c253f4f8544adf682cf8 ]

rte_flow_conv_pattern() and rte_flow_conv_actions() document that the
destination buffer may be NULL when the size is zero, which is how
callers query the number of bytes required before allocating. Both
functions nonetheless walked the destination with ++dst in the first
pass and dst -= num before the second, regardless of size.

Pointer arithmetic on a NULL pointer is undefined behavior, and is
reported by UBSan as "applying non-zero offset to null pointer" for
every RTE_FLOW_CONV_OP_PATTERN and RTE_FLOW_CONV_OP_ACTIONS size query.

Keep the destination pointer fixed and index it only inside the
size-guarded writes, which are never reached when size is zero.

Fixes: 063911ee1df4 ("ethdev: add flow API object converter")

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 lib/ethdev/rte_flow.c | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index c8caa307e2..b26999d721 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -856,5 +856,10 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
 	unsigned int i;
 
-	for (i = 0, off = 0; !num || i != num; ++i, ++src, ++dst) {
+	/*
+	 * dst may be NULL when size is zero, so it is only ever indexed
+	 * inside the size-guarded writes below; pointer arithmetic on a
+	 * NULL pointer is undefined behavior.
+	 */
+	for (i = 0, off = 0; !num || i != num; ++i, ++src) {
 		/**
 		 * allow PMD private flow item
@@ -867,5 +872,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
 				 "cannot convert unknown item type");
 		if (size >= off + sizeof(*dst))
-			*dst = (struct rte_flow_item){
+			dst[i] = (struct rte_flow_item){
 				.type = src->type,
 			};
@@ -876,6 +881,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
 	num = i;
 	src -= num;
-	dst -= num;
-	do {
+	for (i = 0; i != num; ++i, ++src) {
 		if (src->spec) {
 			off = RTE_ALIGN_CEIL(off, sizeof(double));
@@ -885,5 +889,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
 				 RTE_FLOW_CONV_ITEM_SPEC);
 			if (size && size >= off + ret)
-				dst->spec = (void *)(data + off);
+				dst[i].spec = (void *)(data + off);
 			off += ret;
 
@@ -896,5 +900,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
 				 RTE_FLOW_CONV_ITEM_LAST);
 			if (size && size >= off + ret)
-				dst->last = (void *)(data + off);
+				dst[i].last = (void *)(data + off);
 			off += ret;
 		}
@@ -906,10 +910,8 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
 				 RTE_FLOW_CONV_ITEM_MASK);
 			if (size && size >= off + ret)
-				dst->mask = (void *)(data + off);
+				dst[i].mask = (void *)(data + off);
 			off += ret;
 		}
-		++src;
-		++dst;
-	} while (--num);
+	}
 	return off;
 }
@@ -949,5 +951,10 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
 	unsigned int i;
 
-	for (i = 0, off = 0; !num || i != num; ++i, ++src, ++dst) {
+	/*
+	 * dst may be NULL when size is zero, so it is only ever indexed
+	 * inside the size-guarded writes below; pointer arithmetic on a
+	 * NULL pointer is undefined behavior.
+	 */
+	for (i = 0, off = 0; !num || i != num; ++i, ++src) {
 		/**
 		 * allow PMD private flow action
@@ -960,5 +967,5 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
 				 src, "cannot convert unknown action type");
 		if (size >= off + sizeof(*dst))
-			*dst = (struct rte_flow_action){
+			dst[i] = (struct rte_flow_action){
 				.type = src->type,
 			};
@@ -969,6 +976,5 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
 	num = i;
 	src -= num;
-	dst -= num;
-	do {
+	for (i = 0; i != num; ++i, ++src) {
 		if (src->type == RTE_FLOW_ACTION_TYPE_INDIRECT) {
 			/*
@@ -978,5 +984,5 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
 			 */
 			if (size)
-				dst->conf = src->conf;
+				dst[i].conf = src->conf;
 		} else if (src->conf) {
 			off = RTE_ALIGN_CEIL(off, sizeof(double));
@@ -985,10 +991,8 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
 				 size > off ? size - off : 0, src);
 			if (size && size >= off + ret)
-				dst->conf = (void *)(data + off);
+				dst[i].conf = (void *)(data + off);
 			off += ret;
 		}
-		++src;
-		++dst;
-	} while (--num);
+	}
 	return off;
 }
-- 
2.56.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-12-03 12:52:48.634704798 +0000
+++ 0334-ethdev-fix-flow-conversion-with-null-buffer.patch	2026-12-03 12:52:39.253025350 +0000
@@ -1 +1 @@
-From 2ec9682273db70d75a46c253f4f8544adf682cf8 Mon Sep 17 00:00:00 2001
+From 8c2281b677df0efa990223759ee81a970a7784b4 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 2ec9682273db70d75a46c253f4f8544adf682cf8 ]
+
@@ -20 +21,0 @@
-Cc: stable at dpdk.org
@@ -28 +29 @@
-index 0ebf59165d..704ed663c5 100644
+index c8caa307e2..b26999d721 100644
@@ -31 +32 @@
-@@ -922,5 +922,10 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
+@@ -856,5 +856,10 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
@@ -43 +44 @@
-@@ -933,5 +938,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
+@@ -867,5 +872,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
@@ -50 +51 @@
-@@ -942,6 +947,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
+@@ -876,6 +881,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
@@ -58 +59 @@
-@@ -951,5 +955,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
+@@ -885,5 +889,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
@@ -65 +66 @@
-@@ -962,5 +966,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
+@@ -896,5 +900,5 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
@@ -72 +73 @@
-@@ -972,10 +976,8 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
+@@ -906,10 +910,8 @@ rte_flow_conv_pattern(struct rte_flow_item *dst,
@@ -85 +86 @@
-@@ -1015,5 +1017,10 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
+@@ -949,5 +951,10 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
@@ -97 +98 @@
-@@ -1026,5 +1033,5 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
+@@ -960,5 +967,5 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
@@ -104 +105 @@
-@@ -1035,6 +1042,5 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
+@@ -969,6 +976,5 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
@@ -112 +113 @@
-@@ -1044,5 +1050,5 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
+@@ -978,5 +984,5 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
@@ -119 +120 @@
-@@ -1051,10 +1057,8 @@ rte_flow_conv_actions(struct rte_flow_action *dst,
+@@ -985,10 +991,8 @@ rte_flow_conv_actions(struct rte_flow_action *dst,



More information about the stable mailing list