]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bnx2x: fix page fault following EEH recovery
authorDavid Christensen <drc@linux.vnet.ibm.com>
Thu, 8 Jun 2023 20:01:43 +0000 (16:01 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:42:24 +0000 (09:42 +0200)
[ Upstream commit 7ebe4eda4265642859507d1b3ca330d8c196cfe5 ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

index 51b1690fd0459bb1497c29d9312fa559e2ed0009..a1783faf4fe990a2125035ba93b502a0de4196e6 100644 (file)
@@ -14312,11 +14312,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();
 }