All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: thunder: Fix crash upon shutdown after failed probe
@ 2015-11-12 11:55 Pavel Fedin
  2015-11-15 23:30 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Fedin @ 2015-11-12 11:55 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>
---
 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 a937772..372c39e 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);
 }
 
-- 
2.4.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: thunder: Fix crash upon shutdown after failed probe
  2015-11-12 11:55 [PATCH] net: thunder: Fix crash upon shutdown after failed probe Pavel Fedin
@ 2015-11-15 23:30 ` David Miller
  2015-11-16 13:21   ` Pavel Fedin
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2015-11-15 23:30 UTC (permalink / raw)
  To: p.fedin; +Cc: netdev, sgoutham, rric, youngmin.lee, kin-yip.liu

From: Pavel Fedin <p.fedin@samsung.com>
Date: Thu, 12 Nov 2015 14:55:18 +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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] net: thunder: Fix crash upon shutdown after failed probe
  2015-11-15 23:30 ` David Miller
@ 2015-11-16 13:21   ` Pavel Fedin
  2015-11-16 14:26     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Fedin @ 2015-11-16 13:21 UTC (permalink / raw)
  To: 'David Miller'; +Cc: netdev, sgoutham, rric, youngmin.lee, kin-yip.liu

 Hello!

> > 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>
> 
> Applied, thanks.

 Thank you very much, however i've just found one more case where i still get this crash. I should have done this from the
beginning, but please revert it in your repo, i'm sending v2, which covers more cases.
 The new case is feeding the device to vfio after the probe failed. In this case nicvf_remove() is called upon unbind.

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: thunder: Fix crash upon shutdown after failed probe
  2015-11-16 13:21   ` Pavel Fedin
@ 2015-11-16 14:26     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-11-16 14:26 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:21:06 +0300

>  Thank you very much, however i've just found one more case where i
> still get this crash. I should have done this from the beginning,
> but please revert it in your repo, i'm sending v2, which covers more
> cases.  The new case is feeding the device to vfio after the probe
> failed. In this case nicvf_remove() is called upon unbind.

Commits installed in my tree are part of the permanent commit
reccord, and will not be reverted.

Please instead send me a relative patch which takes care of
the other cases.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-16 14:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12 11:55 [PATCH] net: thunder: Fix crash upon shutdown after failed probe Pavel Fedin
2015-11-15 23:30 ` David Miller
2015-11-16 13:21   ` Pavel Fedin
2015-11-16 14:26     ` 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.