diff options
author | Pavel Fedin <p.fedin@samsung.com> | 2015-11-16 17:51:34 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-12-14 21:25:36 -0800 |
commit | 55e483212e6e42a1aca9223e2cc2b48275572031 (patch) | |
tree | 78cdc56dda3abdb756b290ba7eef26be3de84352 /drivers | |
parent | 8f1a7ed477827f6a91c2d0115a8281298d6c5294 (diff) |
net: thunder: Check for driver data in nicvf_remove()
[ Upstream commit 7750130d93decff06120df0d8ea024ff8a038a21 ]
In some cases the crash is caused by nicvf_remove() being called from
outside. For example, if we try to feed the device to vfio after the
probe has failed for some reason. So, move the check to better place.
Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nicvf_main.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index 3b90afb8c293..6f2a748524f3 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c @@ -1325,7 +1325,12 @@ err_disable_device: static void nicvf_remove(struct pci_dev *pdev) { struct net_device *netdev = pci_get_drvdata(pdev); - struct nicvf *nic = netdev_priv(netdev); + struct nicvf *nic; + + if (!netdev) + return; + + nic = netdev_priv(netdev); unregister_netdev(netdev); nicvf_unregister_interrupts(nic); |