net/bnxt: fix uninitialized pointer access in Tx
authorSomnath Kotur <somnath.kotur@broadcom.com>
Sat, 29 Sep 2018 01:59:53 +0000 (18:59 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 11 Oct 2018 16:53:48 +0000 (18:53 +0200)
bnxt_start_xmit() was attempting to access an uninitialized ptr - txbd1
which would lead to segmentation fault.
Fix to initialize ptr to NULL and check for the same before access.

Fixes: f10258e39ec2 ("net/bnxt: fix HW Tx checksum offload check")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_txr.c

index 67bb35e..39be7bd 100644 (file)
@@ -120,7 +120,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 {
        struct bnxt_tx_ring_info *txr = txq->tx_ring;
        struct tx_bd_long *txbd;
-       struct tx_bd_long_hi *txbd1;
+       struct tx_bd_long_hi *txbd1 = NULL;
        uint32_t vlan_tag_flags, cfa_action;
        bool long_bd = false;
        uint16_t last_prod = 0;
@@ -295,7 +295,8 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
        }
 
        txbd->flags_type |= TX_BD_LONG_FLAGS_PACKET_END;
-       txbd1->lflags = rte_cpu_to_le_32(txbd1->lflags);
+       if (txbd1)
+               txbd1->lflags = rte_cpu_to_le_32(txbd1->lflags);
 
        txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);