Browse Source

net: thunder: Fix crash upon shutdown after failed probe

If device probe fails, driver remains bound to the PCI device. However,
driver data has been reset to NULL. This causes crash upon dereferencing
it in nicvf_remove()

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Pavel Fedin 10 years ago
parent
commit
5883d9c6d7
1 changed files with 3 additions and 0 deletions
  1. 3 0
      drivers/net/ethernet/cavium/thunder/nicvf_main.c

+ 3 - 0
drivers/net/ethernet/cavium/thunder/nicvf_main.c

@@ -1600,6 +1600,9 @@ static void nicvf_remove(struct pci_dev *pdev)
 
 static void nicvf_shutdown(struct pci_dev *pdev)
 {
+	if (!pci_get_drvdata(pdev))
+		return;
+
 	nicvf_remove(pdev);
 }