From: Shahed Shaikh Date: Thu, 21 Feb 2019 19:24:44 +0000 (-0800) Subject: net/bnx2x: fix segfaults due to stale interrupt status X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=797ed9916ac73efc8f3d0b1a9a354d50948566c9;p=dpdk.git net/bnx2x: fix segfaults due to stale interrupt status Previous ungraceful exit may leave behind un-acked stale interrupts for slowpath and fastpath. Interrupt status polling function is started before FLR is initiated, so we don't have a real way to protect this polling function invoking an interrupt handler caused due to stale interrupt status from previous ungraceful exit. So, check uninitialized status block variables in interrupt handling path which may lead to segfault. Fixes: 540a211084a7 ("bnx2x: driver core") Cc: stable@dpdk.org Signed-off-by: Shahed Shaikh --- diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 4c775c1639..26b3828e89 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -4201,6 +4201,9 @@ static uint16_t bnx2x_update_dsb_idx(struct bnx2x_softc *sc) struct host_sp_status_block *def_sb = sc->def_sb; uint16_t rc = 0; + if (!def_sb) + return 0; + mb(); /* status block is written to by the chip */ if (sc->def_att_idx != def_sb->atten_status_block.attn_bits_index) { @@ -4525,6 +4528,10 @@ static void bnx2x_handle_fp_tq(struct bnx2x_fastpath *fp, int scan_fp) struct bnx2x_softc *sc = fp->sc; uint8_t more_rx = FALSE; + /* Make sure FP is initialized */ + if (!fp->sb_running_index) + return; + PMD_DEBUG_PERIODIC_LOG(DEBUG, sc, "---> FP TASK QUEUE (%d) <--", fp->index);