From fefa3094f2957e8938b2c38295aed660291133c3 Mon Sep 17 00:00:00 2001 From: Joyce Kong Date: Tue, 5 Dec 2023 04:05:24 +0000 Subject: [PATCH] net/memif: fix segfault with Tx burst larger than 255 There will be a segfault when tx burst size is larger than 256. This is because eth_memif_tx uses an index i which is uint8_t to count transmitted nb_pkts. Extend i to uint16_t, the same size as nb_pkts. Fixes: b5613c8f9d0a ("net/memif: add a Tx fast path") Cc: stable@dpdk.org Reported-by: Liangxing Wang Signed-off-by: Joyce Kong Reviewed-by: Ruifeng Wang Reviewed-by: Stephen Hemminger Acked-by: Ferruh Yigit --- .mailmap | 1 + drivers/net/memif/rte_eth_memif.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index ab0742a3823..86f7bb83f9a 100644 --- a/.mailmap +++ b/.mailmap @@ -788,6 +788,7 @@ Lewei Yang Leyi Rong Liang Ma Liang-Min Larry Wang +Liangxing Wang Liang Xu Liang Zhang Li Feng diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index 7cc8c0da91e..6f45a001724 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -684,7 +684,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) n_free = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE) - slot; } - uint8_t i; + uint16_t i; struct rte_mbuf **buf_tmp = bufs; mbuf_head = *buf_tmp++; struct rte_mempool *mp = mbuf_head->pool;