net/bnxt: fix crash in vector mode Tx

rte_pktmbuf_prefree_seg() can return NULL if the mbuf still
has remaining references on it.

Adding a NULL check to prevent segfault.

Fixes: bc4a000f2f ("net/bnxt: implement SSE vector mode")
Fixes: 3983583414 ("net/bnxt: support NEON")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
This commit is contained in:
Kalesh AP 2020-08-28 10:31:10 +05:30 committed by Ferruh Yigit
parent ce41561d1b
commit 301cc1b4db
2 changed files with 4 additions and 0 deletions

View File

@ -329,6 +329,8 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
tx_buf = &txr->tx_buf_ring[cons]; tx_buf = &txr->tx_buf_ring[cons];
cons = RING_NEXT(txr->tx_ring_struct, cons); cons = RING_NEXT(txr->tx_ring_struct, cons);
mbuf = rte_pktmbuf_prefree_seg(tx_buf->mbuf); mbuf = rte_pktmbuf_prefree_seg(tx_buf->mbuf);
if (unlikely(mbuf == NULL))
continue;
tx_buf->mbuf = NULL; tx_buf->mbuf = NULL;
if (blk && mbuf->pool != free[0]->pool) { if (blk && mbuf->pool != free[0]->pool) {

View File

@ -334,6 +334,8 @@ bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts)
tx_buf = &txr->tx_buf_ring[cons]; tx_buf = &txr->tx_buf_ring[cons];
cons = RING_NEXT(txr->tx_ring_struct, cons); cons = RING_NEXT(txr->tx_ring_struct, cons);
mbuf = rte_pktmbuf_prefree_seg(tx_buf->mbuf); mbuf = rte_pktmbuf_prefree_seg(tx_buf->mbuf);
if (unlikely(mbuf == NULL))
continue;
tx_buf->mbuf = NULL; tx_buf->mbuf = NULL;
if (blk && mbuf->pool != free[0]->pool) { if (blk && mbuf->pool != free[0]->pool) {