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: [email protected]
Reported-by: Stephen Hemminger <[email protected]>
Signed-off-by: Renyong Wan <[email protected]>
---
 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;

Reply via email to