Commit 55e48321 authored by Pavel Fedin's avatar Pavel Fedin Committed by Greg Kroah-Hartman

net: thunder: Check for driver data in nicvf_remove()

[ Upstream commit 7750130d ]

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: default avatarPavel Fedin <p.fedin@samsung.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8f1a7ed4
......@@ -1325,7 +1325,12 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment