From 5883d9c6d7e680bcdc7a8a9ed2509cd10dd98206 Mon Sep 17 00:00:00 2001
From: Pavel Fedin
Date: Thu, 12 Nov 2015 14:55:18 +0300
Subject: [PATCH] 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
Signed-off-by: David S. Miller
---
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index a9377727c11c..372c39e5bcbd 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/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);
}