[PATCH v5 3/4] net/xsc: check Tx queue allocation result
Renyong Wan
wanry at yunsilicon.com
Sun Nov 22 15:22:37 CET 2026
xsc_ethdev_tx_queue_setup() misses the NULL check on the
rte_malloc_socket() result. Return -ENOMEM, as the Rx path does.
Fixes: 488262986eee ("net/xsc: support Rx and Tx queue setup")
Cc: stable at dpdk.org
Reported-by: Stephen Hemminger <stephen at networkplumber.org>
Signed-off-by: Renyong Wan <wanry at yunsilicon.com>
---
drivers/net/xsc/xsc_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c
index 20d6f58f..a5c3e4a6 100644
--- a/drivers/net/xsc/xsc_ethdev.c
+++ b/drivers/net/xsc/xsc_ethdev.c
@@ -545,6 +545,12 @@ xsc_ethdev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
txq = rte_malloc_socket(NULL, sizeof(*txq) + desc_n * sizeof(struct rte_mbuf *),
RTE_CACHE_LINE_SIZE, socket);
+ if (txq == NULL) {
+ PMD_DRV_LOG(ERR, "Port %u create txq idx %d failure",
+ dev->data->port_id, idx);
+ rte_errno = ENOMEM;
+ return -rte_errno;
+ }
txq->offloads = conf->offloads | dev->data->dev_conf.txmode.offloads;
txq->priv = priv;
txq->socket = socket;
More information about the dev
mailing list