4.2-stable review patch. If anyone has any objections, please let me know.
------------------ From: Pavel Fedin <[email protected]> [ 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 <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> --- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- 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); -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
