bnxt_en: Fix NULL pointer dereference
PATCH 1/1 bnxt_en: Fix NULL pointer dereference
PCIe errors detected by a Root Port or Downstream Port cause error recovery services to run on all subordinate devices regardless of administrative state.
The .error_detected() callback, bnxt_io_error_detected(), disables and synchronizes IRQs via bnxt_disable_int_sync(), which calls bnxt_cp_num_to_irq_num() to map completion rings to IRQs using bp->bnapi.
Since bp->bnapi is allocated on NIC open and freed on NIC close, PCIe error recovery on a closed NIC can dereference a NULL pointer.
Check if bp->bnapi is NULL before disabling and synchronizing IRQs.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -5748,7 +5748,7 @@ static void bnxt_disable_int_sync(struct bnxt *bp) {int i; -if (!bp->irq_tbl) +if (!bp->irq_tbl || !bp->bnapi)return ;atomic_inc (&bp->intr_sem);
Signature · 1 line
2.51.0
Quoted 13 lines · Kyle Meyer
PCIe errors detected by a Root Port or Downstream Port cause error recovery services to run on all subordinate devices regardless of administrative state.
The .error_detected() callback,
bnxt_io_error_detected(), disables and synchronizes IRQs viabnxt_disable_int_sync(), which callsbnxt_cp_num_to_irq_num()to map completion rings to IRQs usingbp->bnapi.Since
bp->bnapiis allocated on NIC open and freed on NIC close, PCIe error recovery on a closed NIC can dereference a NULL pointer.
Quoted 9 lines
Check if
bp->bnapiis NULL before disabling and synchronizing IRQs.Fixes e5811b8c09df ("bnxt_en: Add IRQ remapping logic.")Signed-off-by Kyle Meyer <[email protected]>--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
LGTM. Thanks.
Quoted 16 lines
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1
-2@@ -5748,7 +5748,7 @@ static void bnxt_disable_int_sync(struct bnxt *bp) {int i; -if (!bp->irq_tbl) +if (!bp->irq_tbl || !bp->bnapi)return ;atomic_inc (&bp->intr_sem); --2.51.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Fri, 5 Jun 2026 17:25:24 -0500 you wrote:
PCIe errors detected by a Root Port or Downstream Port cause error recovery services to run on all subordinate devices regardless of administrative state.
The .error_detected() callback,
bnxt_io_error_detected(), disables and synchronizes IRQs viabnxt_disable_int_sync(), which callsbnxt_cp_num_to_irq_num()to map completion rings to IRQs usingbp->bnapi.[...]
Here is the summary with links:
- bnxt_en: Fix NULL pointer dereference
https://git.kernel.org/netdev/net/c/d930276f2cdd
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html