Commit 2d5d4154 authored by Ajit Khaparde's avatar Ajit Khaparde Committed by David S. Miller

be2net: Fix a potential crash during shutdown.

adapter could remain uninitialized if probe fails for some reason.
A null pointer access could cause a crash if be_shutdown
is called after that.
Signed-off-by: default avatarAjit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1e581486
...@@ -3141,12 +3141,14 @@ static int be_resume(struct pci_dev *pdev) ...@@ -3141,12 +3141,14 @@ static int be_resume(struct pci_dev *pdev)
static void be_shutdown(struct pci_dev *pdev) static void be_shutdown(struct pci_dev *pdev)
{ {
struct be_adapter *adapter = pci_get_drvdata(pdev); struct be_adapter *adapter = pci_get_drvdata(pdev);
struct net_device *netdev = adapter->netdev;
if (netif_running(netdev)) if (!adapter)
return;
if (netif_running(adapter->netdev))
cancel_delayed_work_sync(&adapter->work); cancel_delayed_work_sync(&adapter->work);
netif_device_detach(netdev); netif_device_detach(adapter->netdev);
be_cmd_reset_function(adapter); be_cmd_reset_function(adapter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment