aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@emulex.com>2011-04-06 01:53:13 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-06 15:40:18 -0400
commit2d5d4154650459b61a8e7097d186a89d89dab8ed (patch)
tree1a68a7ce66ee6fae5731e53287f7e3c54209c394 /drivers/net/benet
parent1e58148670908e9fd180761c0eed3839b6778f01 (diff)
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: Ajit Khaparde <ajit.khaparde@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet')
-rw-r--r--drivers/net/benet/be_main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index a71163f1e34b..6e8e211d8afe 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -3141,12 +3141,14 @@ static int be_resume(struct pci_dev *pdev)
3141static void be_shutdown(struct pci_dev *pdev) 3141static void be_shutdown(struct pci_dev *pdev)
3142{ 3142{
3143 struct be_adapter *adapter = pci_get_drvdata(pdev); 3143 struct be_adapter *adapter = pci_get_drvdata(pdev);
3144 struct net_device *netdev = adapter->netdev;
3145 3144
3146 if (netif_running(netdev)) 3145 if (!adapter)
3146 return;
3147
3148 if (netif_running(adapter->netdev))
3147 cancel_delayed_work_sync(&adapter->work); 3149 cancel_delayed_work_sync(&adapter->work);
3148 3150
3149 netif_device_detach(netdev); 3151 netif_device_detach(adapter->netdev);
3150 3152
3151 be_cmd_reset_function(adapter); 3153 be_cmd_reset_function(adapter);
3152 3154