net/bnxt: avoid null pointer dereference
authorLance Richardson <lance.richardson@broadcom.com>
Wed, 17 Jul 2019 10:41:34 +0000 (16:11 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 23 Jul 2019 12:31:35 +0000 (14:31 +0200)
Avoid null pointer dereference when allocating an insulated
completion ring by basing nq ring allocation on whether an
nq ring was requested instead of whether the device supports
nq rings.

Fixes: f8168ca0e690 ("net/bnxt: support thor controller")

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_ring.c

index faf861c..ada748c 100644 (file)
@@ -280,7 +280,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
        }
        cp_ring_info->hw_stats_ctx_id = HWRM_NA_SIGNATURE;
 
-       if (BNXT_HAS_NQ(bp)) {
+       if (nq_ring_info) {
                struct bnxt_ring *nq_ring = nq_ring_info->cp_ring_struct;
 
                nq_ring->bd = (char *)mz->addr + nq_ring_start;