From: Rahul Lakkireddy Date: Tue, 1 Sep 2020 17:20:09 +0000 (+0530) Subject: net/cxgbe: fix crash when accessing empty Tx mbuf list X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=dca62adebf68ec94d84444fd2a61f03f73f51ffb;p=dpdk.git net/cxgbe: fix crash when accessing empty Tx mbuf list Ensure packets are available before accessing the mbuf list in Tx burst function. Otherwise, just reclaim completed Tx descriptors and exit. Fixes: b1df19e43e1d ("net/cxgbe: fix prefetch for non-coalesced Tx packets") Cc: stable@dpdk.org Reported-by: Brian Poole Signed-off-by: Rahul Lakkireddy --- diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 7c6016d5cf..1205e17a6c 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -71,6 +71,9 @@ uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, t4_os_lock(&txq->txq_lock); /* free up desc from already completed tx */ reclaim_completed_tx(&txq->q); + if (unlikely(!nb_pkts)) + goto out_unlock; + rte_prefetch0(rte_pktmbuf_mtod(tx_pkts[0], volatile void *)); while (total_sent < nb_pkts) { pkts_remain = nb_pkts - total_sent; @@ -91,6 +94,7 @@ uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, reclaim_completed_tx(&txq->q); } +out_unlock: t4_os_unlock(&txq->txq_lock); return total_sent; }