Patch "bnxt_en: Fix NULL pointer dereference in reopen failure path" has been added to the 4.4-stable tree
This is a note to let you know that I've just added the patch titled
bnxt_en: Fix NULL pointer dereference in reopen failure path
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
bnxt_en-fix-null-pointer-dereference-in-reopen-failure-path.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Thu Dec 21 10:35:49 CET 2017
From: Sankar Patchineelam <[email protected]>
Date: Tue, 28 Mar 2017 19:47:29 -0400
Subject: bnxt_en: Fix NULL pointer dereference in reopen failure path
From: Sankar Patchineelam <[email protected]>
[ Upstream commit 2247925f0942dc4e7c09b1cde45ca18461d94c5f ]
Net device reset can fail when the h/w or f/w is in a bad state. Subsequent netdevice open fails in bnxt_hwrm_stat_ctx_alloc(). The cleanup invokes bnxt_hwrm_resource_free() which inturn calls bnxt_disable_int(). In this routine, the code segment
if (ring->fw_ring_id != INVALID_HW_RING_ID)
BNXT_CP_DB(cpr->cp_doorbell, cpr->cp_raw_cons);
results in NULL pointer dereference as cpr->cp_doorbell is not yet initialized, and fw_ring_id is zero.
The fix is to initialize cpr fw_ring_id to INVALID_HW_RING_ID before bnxt_init_chip() is invoked.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +13 -0
@@ -2014,6 +2014,18 @@ static int bnxt_init_one_rx_ring(structreturn 0 ; } +static void bnxt_init_cp_rings (struct bnxt *bp) +{ +int i; + +for (i =0 ; i < bp->cp_nr_rings; i++) { +struct bnxt_cp_ring_info *cpr = &bp->bnapi[i]->cp_ring; +struct bnxt_ring_struct *ring = &cpr->cp_ring_struct; + + ring->fw_ring_id =INVALID_HW_RING_ID ; + } +} +static int bnxt_init_rx_rings (struct bnxt *bp) {int i, rc =0 ;
@@ -3977,6 +3989,7 @@ static int bnxt_shutdown_nic(struct bnxtstatic int bnxt_init_nic (struct bnxt *bp,bool irq_re_init) { +bnxt_init_cp_rings (bp);bnxt_init_rx_rings (bp);bnxt_init_tx_rings (bp);bnxt_init_ring_grps (bp, irq_re_init);
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/bnxt_en-fix-null-pointer-dereference-in-reopen-failure-path.patch