[PATCH v1] net/memif: fix segfault with Tx burst larger than 255

Joyce Kong joyce.kong at arm.com
Tue Dec 5 05:05:24 CET 2023


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 at dpdk.org

Reported-by: Liangxing Wang <liangxing.wang at arm.com>
Signed-off-by: Joyce Kong <joyce.kong at arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>
---
 drivers/net/memif/rte_eth_memif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 7cc8c0da91..6f45a00172 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;
-- 
2.25.1



More information about the stable mailing list