netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/mlx4_core: Fix Oops on reboot when SRIOV VFs are probed into the Host
@ 2014-06-01 10:49 Or Gerlitz
  2014-06-01 16:41 ` Sergei Shtylyov
  2014-06-02 14:29 ` Wei Yang
  0 siblings, 2 replies; 13+ messages in thread
From: Or Gerlitz @ 2014-06-01 10:49 UTC (permalink / raw)
  To: davem; +Cc: netdev, amirv, weiyang, Jack Morgenstein, Or Gerlitz

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

Commit befdf89 did not take into account the case where the Host
driver is being unloaded. In this case, pci_get_drvdata for the VF
remove_one call may return NULL, so that dereferencing the priv
struct results in a kernel oops.

The fix is to also test that the dev pointer returned by
pci_get_drvdata is non-NULL.

Fixes: befdf89 ("preserve pcd_dev_data after __mlx4_remove_one()")
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index c187d74..a6ae089 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2629,7 +2629,7 @@ static void __mlx4_remove_one(struct pci_dev *pdev)
 	int               pci_dev_data;
 	int p;
 
-	if (priv->removed)
+	if (!dev || priv->removed)
 		return;
 
 	pci_dev_data = priv->pci_dev_data;
-- 
1.7.1

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

end of thread, other threads:[~2014-06-08  9:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-01 10:49 [PATCH net] net/mlx4_core: Fix Oops on reboot when SRIOV VFs are probed into the Host Or Gerlitz
2014-06-01 16:41 ` Sergei Shtylyov
2014-06-01 19:59   ` Or Gerlitz
2014-06-02 14:29 ` Wei Yang
2014-06-02 16:10   ` Bjorn Helgaas
2014-06-03  0:58     ` David Miller
2014-06-03  2:00     ` Wei Yang
2014-06-03  8:15     ` Or Gerlitz
2014-06-03  8:40       ` Wei Yang
2014-06-04  9:50       ` Wei Yang
2014-06-06  2:52       ` Wei Yang
2014-06-08  9:18         ` Or Gerlitz
2014-06-08  9:16     ` Or Gerlitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).