[PATCH v6 1/2] net/af_xdp: Fix use after free in af_xdp_tx_zc
Ariel Otilibili
ariel.otilibili at 6wind.com
Sat Feb 1 00:10:19 CET 2025
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>
---
.mailmap | 2 +-
drivers/net/af_xdp/rte_eth_af_xdp.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/.mailmap b/.mailmap
index 76f65e5114d4..42fcefacf573 100644
--- a/.mailmap
+++ b/.mailmap
@@ -134,7 +134,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>
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 814398ba4b44..092bcb73aa0a 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -574,6 +574,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 =
@@ -601,11 +602,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.30.2
More information about the stable
mailing list