Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bnx2x: fix page fault following EEH recovery

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>

authored by

David Christensen and committed by
David S. Miller
7ebe4eda 65d8bd81

+7 -2
+7 -2
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 14294 14294 bp->fw_seq = SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & 14295 14295 DRV_MSG_SEQ_NUMBER_MASK; 14296 14296 14297 - if (netif_running(dev)) 14298 - bnx2x_nic_load(bp, LOAD_NORMAL); 14297 + if (netif_running(dev)) { 14298 + if (bnx2x_nic_load(bp, LOAD_NORMAL)) { 14299 + netdev_err(bp->dev, "Error during driver initialization, try unloading/reloading the driver\n"); 14300 + goto done; 14301 + } 14302 + } 14299 14303 14300 14304 netif_device_attach(dev); 14301 14305 14306 + done: 14302 14307 rtnl_unlock(); 14303 14308 } 14304 14309