From ee07b4ac65872dd8e1ab094a09d7b280a2e0fd6b Mon Sep 17 00:00:00 2001 From: Lance Richardson Date: Wed, 17 Jul 2019 16:11:34 +0530 Subject: [PATCH] net/bnxt: avoid null pointer dereference 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 Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index faf861cc1b..ada748c051 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -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; -- 2.20.1