From 4458106453b736350bbe67faee3d5597b81b0730 Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Mon, 11 Nov 2024 16:42:20 +0000 Subject: [PATCH] net/iavf: add segment-length check to Tx prep In the Tx prep function, the metadata checks were only checking the packet length and ignoring the data length. For single-buffer packets we can quickly check that the data length is the packet length. Fixes: 19ee91c6bd9a ("net/iavf: check illegal packet sizes") Cc: stable@dpdk.org Reported-by: Padraig Connolly Signed-off-by: Bruce Richardson Acked-by: Vladimir Medvedkin Tested-by: Padraig Connolly --- drivers/net/iavf/iavf_rxtx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 4850b9e3811..6a093c67469 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -3677,7 +3677,11 @@ iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, return i; } - if (m->pkt_len < IAVF_TX_MIN_PKT_LEN) { + /* valid packets are greater than min size, and single-buffer pkts + * must have data_len == pkt_len + */ + if (m->pkt_len < IAVF_TX_MIN_PKT_LEN || + (m->nb_segs == 1 && m->data_len != m->pkt_len)) { rte_errno = EINVAL; return i; }