patch 'net/qede: fix use after free' has been queued to stable release 23.11.5

Xueming Li xuemingl at nvidia.com
Thu Jun 26 14:01:03 CEST 2025


Hi,

FYI, your patch has been queued to stable release 23.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 06/28/25. 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=f7c324657056f1fad001c3fd1f153a02b2c2ec81

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From f7c324657056f1fad001c3fd1f153a02b2c2ec81 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Thu, 13 Mar 2025 10:22:03 -0700
Subject: [PATCH] net/qede: fix use after free
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit ab8caba639ee6378055b2d8518e2a97b2212c737 ]

The loop cleaning up flowdir resources was using SLIST_FOREACH
but the inner loop would call rte_free. Found by building with
address sanitizer undefined check.

Also remove needless initialization, and null check.

Fixes: f5765f66f9bb ("net/qede: refactor flow director into generic aRFS")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/qede/qede_filter.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c
index e547b24a73..90f8b89681 100644
--- a/drivers/net/qede/qede_filter.c
+++ b/drivers/net/qede/qede_filter.c
@@ -12,6 +12,13 @@
 
 #include "qede_ethdev.h"
 
+#ifndef SLIST_FOREACH_SAFE
+#define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\
+	for ((var) = SLIST_FIRST((head));				\
+	    (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\
+	    (var) = (tvar))
+#endif
+
 /* VXLAN tunnel classification mapping */
 const struct _qede_udp_tunn_types {
 	uint16_t rte_filter_type;
@@ -154,16 +161,13 @@ int qede_check_fdir_support(struct rte_eth_dev *eth_dev)
 void qede_fdir_dealloc_resc(struct rte_eth_dev *eth_dev)
 {
 	struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
-	struct qede_arfs_entry *tmp = NULL;
+	struct qede_arfs_entry *tmp, *tmp2;
 
-	SLIST_FOREACH(tmp, &qdev->arfs_info.arfs_list_head, list) {
-		if (tmp) {
-			if (tmp->mz)
-				rte_memzone_free(tmp->mz);
-			SLIST_REMOVE(&qdev->arfs_info.arfs_list_head, tmp,
-				     qede_arfs_entry, list);
-			rte_free(tmp);
-		}
+	SLIST_FOREACH_SAFE(tmp, &qdev->arfs_info.arfs_list_head, list, tmp2) {
+		if (tmp->mz)
+			rte_memzone_free(tmp->mz);
+		SLIST_REMOVE(&qdev->arfs_info.arfs_list_head, tmp, qede_arfs_entry, list);
+		rte_free(tmp);
 	}
 }
 
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2025-06-26 19:59:19.538770654 +0800
+++ 0043-net-qede-fix-use-after-free.patch	2025-06-26 19:59:17.382418044 +0800
@@ -1 +1 @@
-From ab8caba639ee6378055b2d8518e2a97b2212c737 Mon Sep 17 00:00:00 2001
+From f7c324657056f1fad001c3fd1f153a02b2c2ec81 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit ab8caba639ee6378055b2d8518e2a97b2212c737 ]
@@ -13 +15,0 @@
-Cc: stable at dpdk.org
@@ -17,2 +19,2 @@
- drivers/net/qede/qede_filter.c | 20 ++++++++++++--------
- 1 file changed, 12 insertions(+), 8 deletions(-)
+ drivers/net/qede/qede_filter.c | 22 +++++++++++++---------
+ 1 file changed, 13 insertions(+), 9 deletions(-)
@@ -21 +23 @@
-index 14fb4338e9..cecb58c997 100644
+index e547b24a73..90f8b89681 100644
@@ -38 +40 @@
-@@ -154,15 +161,12 @@ int qede_check_fdir_support(struct rte_eth_dev *eth_dev)
+@@ -154,16 +161,13 @@ int qede_check_fdir_support(struct rte_eth_dev *eth_dev)
@@ -47 +49,2 @@
--			rte_memzone_free(tmp->mz);
+-			if (tmp->mz)
+-				rte_memzone_free(tmp->mz);
@@ -53 +56,2 @@
-+		rte_memzone_free(tmp->mz);
++		if (tmp->mz)
++			rte_memzone_free(tmp->mz);


More information about the stable mailing list