patch 'net/af_xdp: fix use after free in zero-copy Tx' has been queued to stable release 23.11.5

Xueming Li xuemingl at nvidia.com
Thu Jun 26 14:00:53 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=c8e1da2dc3c718f37d5609ef1b01bf8d2be6a339

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From c8e1da2dc3c718f37d5609ef1b01bf8d2be6a339 Mon Sep 17 00:00:00 2001
From: Ariel Otilibili <ariel.otilibili at 6wind.com>
Date: Wed, 26 Feb 2025 21:08:40 +0100
Subject: [PATCH] net/af_xdp: fix use after free in zero-copy Tx
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit a23bf7fde78b10afbbafda252f15495b26e010a9 ]

tx_bytes is computed after both legs are tested. This might
produce a use after memory free.

The computation is now moved into each leg.

Bugzilla ID: 1440
Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks")

Signed-off-by: Ariel Otilibili <ariel.otilibili at 6wind.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 74f750dbb3..668b184b94 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -570,6 +570,7 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 					umem->mb_pool->header_size;
 			offset = offset << XSK_UNALIGNED_BUF_OFFSET_SHIFT;
 			desc->addr = addr | offset;
+			tx_bytes += desc->len;
 			count++;
 		} else {
 			struct rte_mbuf *local_mbuf =
@@ -597,11 +598,10 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			desc->addr = addr | offset;
 			rte_memcpy(pkt, rte_pktmbuf_mtod(mbuf, void *),
 					desc->len);
+			tx_bytes += desc->len;
 			rte_pktmbuf_free(mbuf);
 			count++;
 		}
-
-		tx_bytes += mbuf->pkt_len;
 	}
 
 out:
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2025-06-26 19:59:19.218817167 +0800
+++ 0033-net-af_xdp-fix-use-after-free-in-zero-copy-Tx.patch	2025-06-26 19:59:17.338418046 +0800
@@ -1 +1 @@
-From a23bf7fde78b10afbbafda252f15495b26e010a9 Mon Sep 17 00:00:00 2001
+From c8e1da2dc3c718f37d5609ef1b01bf8d2be6a339 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit a23bf7fde78b10afbbafda252f15495b26e010a9 ]
@@ -13 +15,0 @@
-Cc: stable at dpdk.org
@@ -18 +19,0 @@
- .mailmap                            | 2 +-
@@ -20 +21 @@
- 2 files changed, 3 insertions(+), 3 deletions(-)
+ 1 file changed, 2 insertions(+), 2 deletions(-)
@@ -22,13 +22,0 @@
-diff --git a/.mailmap b/.mailmap
-index 4b781bd3fb..822936f615 100644
---- a/.mailmap
-+++ b/.mailmap
-@@ -135,7 +135,7 @@ Anupam Kapoor <anupam.kapoor at gmail.com>
- Apeksha Gupta <apeksha.gupta at nxp.com>
- Archana Muniganti <marchana at marvell.com> <muniganti.archana at caviumnetworks.com>
- Archit Pandey <architpandeynitk at gmail.com>
--Ariel Otilibili <otilibil at eurecom.fr> <ariel.otilibili at 6wind.com>
-+Ariel Otilibili <ariel.otilibili at 6wind.com> <otilibil at eurecom.fr>
- Arkadiusz Kubalewski <arkadiusz.kubalewski at intel.com>
- Arkadiusz Kusztal <arkadiuszx.kusztal at intel.com>
- Arnaud Fiorini <arnaud.fiorini at polymtl.ca>
@@ -36 +24 @@
-index 814398ba4b..092bcb73aa 100644
+index 74f750dbb3..668b184b94 100644
@@ -39 +27 @@
-@@ -574,6 +574,7 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
+@@ -570,6 +570,7 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
@@ -47 +35 @@
-@@ -601,11 +602,10 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
+@@ -597,11 +598,10 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)


More information about the stable mailing list