Skip to contentSkip to conversation

mpt fusion: Avoid racing when mptsas and mptcl module are loaded in parallel

PATCH In review Prakash, Sathya 2 participants 2 messages Feb 8, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 mpt fusion: Avoid racing when mptsas and mptcl module are loaded in parallel

This patch sets the IOC pointer in drvrdata of pcidev before adding the IOC into the list of IOCs. Without this patch the driver oops when the mptsas and mptctl modules are loaded in parallel.

---

drivers/message/fusion/mptbase.c +3 -1
index 355c172..d473146 100644
@@ -1704,6 +1704,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
 	ioc->active = 0;
 	CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
 
+	/* Set IOC ptr in the pcidev's driver data. */
+	pci_set_drvdata(ioc->pcidev, ioc);
+
 	/* Set lookup ptr. */
 	list_add_tail(&ioc->list, &ioc_list);
 
@@ -2074,7 +2077,6 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
 			irq_allocated = 1;
 			ioc->pci_irq = ioc->pcidev->irq;
 			pci_set_master(ioc->pcidev);		/* ?? */
-			pci_set_drvdata(ioc->pcidev, ioc);
 			dprintk(ioc, printk(MYIOC_s_INFO_FMT "installed at interrupt "
 			    "%d\n", ioc->name, ioc->pcidev->irq));
 		}
maintainer
#1 lore raw
Quoted 3 lines · Sathya

This patch sets the IOC pointer in drvrdata of pcidev before adding the IOC into the list of IOCs. Without this patch the driver oops when the mptsas and mptctl modules are loaded in parallel.

Much better, thanks.

Would I be correct in assuming that even though this email says [PATCH 3/3] there aren't two missing precursor patches?

James