From 9ecb2ce7826e2d8eabd6f3df27b76cfcab3e3fd1 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Mon, 13 Jul 2020 10:47:59 +0530 Subject: [PATCH] net/bnxt: fix crash during Tx When TRUFLOW is not enabled ulp_ctx is not allocated. In non-vector Tx datapath we are accessing this invalid pointer resulting in a segfault. Check if TRUFLOW is enabled before accessing ulp_ctx to avoid this. Fixes: 1e46b3962620 ("net/bnxt: fill cfa action in Tx descriptor") Signed-off-by: Ajit Khaparde Signed-off-by: Somnath Kotur Reviewed-by: Venkat Duvvuru --- drivers/net/bnxt/bnxt_txr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c index f5884268ed..c741c7188b 100644 --- a/drivers/net/bnxt/bnxt_txr.c +++ b/drivers/net/bnxt/bnxt_txr.c @@ -132,8 +132,9 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt, PKT_TX_TUNNEL_GRE | PKT_TX_TUNNEL_VXLAN | PKT_TX_TUNNEL_GENEVE | PKT_TX_IEEE1588_TMST | PKT_TX_QINQ_PKT) || - txq->bp->ulp_ctx->cfg_data->tx_cfa_action || - txq->vfr_tx_cfa_action) + (BNXT_TRUFLOW_EN(txq->bp) && + (txq->bp->ulp_ctx->cfg_data->tx_cfa_action || + txq->vfr_tx_cfa_action))) long_bd = true; nr_bds = long_bd + tx_pkt->nb_segs; -- 2.20.1