[PATCH 1/4] ethdev: verify queue ID when Tx done cleanup

Jie Hai haijie1 at huawei.com
Thu Sep 5 08:46:35 CEST 2024


From: Chengwen Feng <fengchengwen at huawei.com>

Verify queue_id for rte_eth_tx_done_cleanup API.

Fixes: 44a718c457b5 ("ethdev: add API to free consumed buffers in Tx ring")
Cc: stable at dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
 lib/ethdev/rte_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index f1c658f49e80..998deb5ab101 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -2823,6 +2823,10 @@ rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
+	ret = eth_dev_validate_tx_queue(dev, queue_id);
+	if (ret != 0)
+		return ret;
+
 	if (*dev->dev_ops->tx_done_cleanup == NULL)
 		return -ENOTSUP;
 
-- 
2.22.0



More information about the dev mailing list