All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bnxt_en: Fix NULL pointer dereference
@ 2026-06-05 22:25 Kyle Meyer
  2026-06-07 13:18 ` Pavan Chebbi
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Meyer @ 2026-06-05 22:25 UTC (permalink / raw)
  To: michael.chan, pavan.chebbi, andrew+netdev, davem, edumazet, kuba,
	pabeni
  Cc: netdev, linux-kernel

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.

Fixes: e5811b8c09df ("bnxt_en: Add IRQ remapping logic.")
Cc: stable@vger.kernel.org
Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 008c34cff7b4..ec38a0a40875 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bnxt_en: Fix NULL pointer dereference
  2026-06-05 22:25 [PATCH] bnxt_en: Fix NULL pointer dereference Kyle Meyer
@ 2026-06-07 13:18 ` Pavan Chebbi
  0 siblings, 0 replies; 2+ messages in thread
From: Pavan Chebbi @ 2026-06-07 13:18 UTC (permalink / raw)
  To: Kyle Meyer
  Cc: michael.chan, andrew+netdev, davem, edumazet, kuba, pabeni,
	netdev, linux-kernel

On Sat, Jun 6, 2026 at 3:55 AM Kyle Meyer <kyle.meyer@hpe.com> 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 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.
>
> Fixes: e5811b8c09df ("bnxt_en: Add IRQ remapping logic.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
> ---
>  drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

LGTM. Thanks.
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>

> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 008c34cff7b4..ec38a0a40875 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-07 13:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-05 22:25 [PATCH] bnxt_en: Fix NULL pointer dereference Kyle Meyer
2026-06-07 13:18 ` Pavan Chebbi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.