From f7ecea911ec52fc94aba82cc65211e613f8b56df Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Thu, 28 Sep 2017 16:43:42 -0500 Subject: [PATCH] net/bnxt: fix interrupt handler In some cases the interrupt handler is accessing cpr, which has already been freed causing segfaults. This patch avoids such accesses. Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification") Cc: stable@dpdk.org Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_cpr.c | 2 ++ drivers/net/bnxt/bnxt_irq.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index 68979bc43d..26b2755e12 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -183,8 +183,10 @@ void bnxt_free_def_cp_ring(struct bnxt *bp) return; bnxt_free_ring(cpr->cp_ring_struct); + cpr->cp_ring_struct = NULL; rte_free(cpr->cp_ring_struct); rte_free(cpr); + bp->def_cp_ring = NULL; } /* For the default completion ring only */ diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c index 47cda7e521..79a119623a 100644 --- a/drivers/net/bnxt/bnxt_irq.c +++ b/drivers/net/bnxt/bnxt_irq.c @@ -55,6 +55,9 @@ static void bnxt_int_handler(void *param) struct cmpl_base *cmp; while (1) { + if (!cpr || !cpr->cp_ring_struct) + return; + cons = RING_CMP(cpr->cp_ring_struct, raw_cons); cmp = &cpr->cp_desc_ring[cons]; -- 2.20.1