]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: thunder: Fix crash upon shutdown after failed probe
authorPavel Fedin <p.fedin@samsung.com>
Thu, 12 Nov 2015 11:55:18 +0000 (14:55 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Nov 2015 23:30:00 +0000 (18:30 -0500)
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>
drivers/net/ethernet/cavium/thunder/nicvf_main.c

index a9377727c11c3fdb18a09f16ce8366ae4ef48057..372c39e5bcbd88860bcd09c7d16471d91e654119 100644 (file)
@@ -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);
 }