* [PATCH v2] net: thunder: Fix crash upon shutdown after failed probe
@ 2015-11-16 13:22 Pavel Fedin
2015-11-16 14:27 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Fedin @ 2015-11-16 13:22 UTC (permalink / raw)
To: netdev; +Cc: Sunil Goutham, Robert Richter, youngmin.lee, kin-yip.liu
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>
---
v1 => v2:
- Do the test in nicvf_remove(), this allows to cover more situations
---
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index a937772..7f709cb 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -1583,8 +1583,14 @@ 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 net_device *pnetdev = nic->pnicvf->netdev;
+ struct nicvf *nic;
+ struct net_device *pnetdev;
+
+ if (!netdev)
+ return;
+
+ nic = netdev_priv(netdev);
+ pnetdev = nic->pnicvf->netdev;
/* Check if this Qset is assigned to different VF.
* If yes, clean primary and all secondary Qsets.
--
2.4.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] net: thunder: Fix crash upon shutdown after failed probe
2015-11-16 13:22 [PATCH v2] net: thunder: Fix crash upon shutdown after failed probe Pavel Fedin
@ 2015-11-16 14:27 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-11-16 14:27 UTC (permalink / raw)
To: p.fedin; +Cc: netdev, sgoutham, rric, youngmin.lee, kin-yip.liu
From: Pavel Fedin <p.fedin@samsung.com>
Date: Mon, 16 Nov 2015 16:22:26 +0300
> 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>
> ---
> v1 => v2:
> - Do the test in nicvf_remove(), this allows to cover more situations
Please send me a relative fix on top of the other change, rather
than a complete replacement patch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-16 14:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-16 13:22 [PATCH v2] net: thunder: Fix crash upon shutdown after failed probe Pavel Fedin
2015-11-16 14:27 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.