[ofa-general] [PATCH] IB/mthca: fix use-after-free

Michael S. Tsirkin mst at dev.mellanox.co.il
Thu May 17 01:10:51 PDT 2007


From: Ali Ayoub <ali at mellanox.co.il>

Fix use-after-free on hardware restart.

Signed-off-by: Michael S. Tsirkin <mst at dev.mellanox.co.il>

---

--- ./drivers/infiniband/hw/mthca/mthca_main.c.orig	2007-05-17 11:01:28.000000000 +0300
+++ ./drivers/infiniband/hw/mthca/mthca_main.c	2007-05-17 11:02:36.000000000 +0300
@@ -1250,12 +1250,14 @@
 int __mthca_restart_one(struct pci_dev *pdev)
 {
 	struct mthca_dev *mdev;
+	int hca_type;
 
 	mdev = pci_get_drvdata(pdev);
+	hca_type = mdev->hca_type;
 	if (!mdev)
 		return -ENODEV;
 	__mthca_remove_one(pdev);
-	return __mthca_init_one(pdev, mdev->hca_type);
+	return __mthca_init_one(pdev, hca_type);
 }
 
 static int __devinit mthca_init_one(struct pci_dev *pdev,


-- 
Michael S. Tsirkin - Staff Engineer, Mellanox Technologies Ltd.
Eternity is a very long time, especially towards the end.



More information about the general mailing list