netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bnx2x: fix page fault following EEH recovery
@ 2023-06-08 20:01 David Christensen
  2023-06-08 23:40 ` Samudrala, Sridhar
  2023-06-10 19:12 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: David Christensen @ 2023-06-08 20:01 UTC (permalink / raw)
  To: manishc, aelior, skalluru; +Cc: netdev, David Christensen

In the last step of the EEH recovery process, the EEH driver calls into
bnx2x_io_resume() to re-initialize the NIC hardware via the function
bnx2x_nic_load().  If an error occurs during bnx2x_nic_load(), OS and
hardware resources are released and an error code is returned to the
caller.  When called from bnx2x_io_resume(), the return code is ignored
and the network interface is brought up unconditionally.  Later attempts
to send a packet via this interface result in a page fault due to a null
pointer reference.

This patch checks the return code of bnx2x_nic_load(), prints an error
message if necessary, and does not enable the interface.

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 637d162bbcfa..1e7a6f1d4223 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -14294,11 +14294,16 @@ static void bnx2x_io_resume(struct pci_dev *pdev)
 	bp->fw_seq = SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) &
 							DRV_MSG_SEQ_NUMBER_MASK;
 
-	if (netif_running(dev))
-		bnx2x_nic_load(bp, LOAD_NORMAL);
+	if (netif_running(dev)) {
+		if (bnx2x_nic_load(bp, LOAD_NORMAL)) {
+			netdev_err(bp->dev, "Error during driver initialization, try unloading/reloading the driver\n");
+			goto done;
+		}
+	}
 
 	netif_device_attach(dev);
 
+done:
 	rtnl_unlock();
 }
 
-- 
2.31.1


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

* Re: [PATCH] bnx2x: fix page fault following EEH recovery
  2023-06-08 20:01 [PATCH] bnx2x: fix page fault following EEH recovery David Christensen
@ 2023-06-08 23:40 ` Samudrala, Sridhar
  2023-06-10 19:12 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Samudrala, Sridhar @ 2023-06-08 23:40 UTC (permalink / raw)
  To: David Christensen, manishc, aelior, skalluru; +Cc: netdev



On 6/8/2023 1:01 PM, David Christensen wrote:
> In the last step of the EEH recovery process, the EEH driver calls into
> bnx2x_io_resume() to re-initialize the NIC hardware via the function
> bnx2x_nic_load().  If an error occurs during bnx2x_nic_load(), OS and
> hardware resources are released and an error code is returned to the
> caller.  When called from bnx2x_io_resume(), the return code is ignored
> and the network interface is brought up unconditionally.  Later attempts
> to send a packet via this interface result in a page fault due to a null
> pointer reference.
> 
> This patch checks the return code of bnx2x_nic_load(), prints an error
> message if necessary, and does not enable the interface.
> 
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>

Reviewed-by: Sridhar Samudrala <sridhar.samudrala@intel.com>

> ---
>   drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> index 637d162bbcfa..1e7a6f1d4223 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> @@ -14294,11 +14294,16 @@ static void bnx2x_io_resume(struct pci_dev *pdev)
>   	bp->fw_seq = SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) &
>   							DRV_MSG_SEQ_NUMBER_MASK;
>   
> -	if (netif_running(dev))
> -		bnx2x_nic_load(bp, LOAD_NORMAL);
> +	if (netif_running(dev)) {
> +		if (bnx2x_nic_load(bp, LOAD_NORMAL)) {
> +			netdev_err(bp->dev, "Error during driver initialization, try unloading/reloading the driver\n");
> +			goto done;
> +		}
> +	}
>   
>   	netif_device_attach(dev);
>   
> +done:
>   	rtnl_unlock();
>   }
>   

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

* Re: [PATCH] bnx2x: fix page fault following EEH recovery
  2023-06-08 20:01 [PATCH] bnx2x: fix page fault following EEH recovery David Christensen
  2023-06-08 23:40 ` Samudrala, Sridhar
@ 2023-06-10 19:12 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-10 19:12 UTC (permalink / raw)
  To: David Christensen; +Cc: manishc, aelior, skalluru, netdev

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Thu,  8 Jun 2023 16:01:43 -0400 you wrote:
> In the last step of the EEH recovery process, the EEH driver calls into
> bnx2x_io_resume() to re-initialize the NIC hardware via the function
> bnx2x_nic_load().  If an error occurs during bnx2x_nic_load(), OS and
> hardware resources are released and an error code is returned to the
> caller.  When called from bnx2x_io_resume(), the return code is ignored
> and the network interface is brought up unconditionally.  Later attempts
> to send a packet via this interface result in a page fault due to a null
> pointer reference.
> 
> [...]

Here is the summary with links:
  - bnx2x: fix page fault following EEH recovery
    https://git.kernel.org/netdev/net/c/7ebe4eda4265

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-06-10 19:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 20:01 [PATCH] bnx2x: fix page fault following EEH recovery David Christensen
2023-06-08 23:40 ` Samudrala, Sridhar
2023-06-10 19:12 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).