Skip to contentSkip to conversation

mpt fusion: Fix for module load error when mptctl and mptsas are loaded in parallel

PATCH In review Prakash, Sathya 2 participants 2 messages Jan 11, 2008

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

PATCH 3/3 mpt fusion: Fix for module load error when mptctl and mptsas are loaded in parallel

This patch fixes a panic at mptctl_probe -> mutex_init if the mptsas and mptcl module are loaded in parallel, this is because IOC is NULL, the fix is in mpt_device_register to call probe only with non-zero IOC pointer.

---

drivers/message/fusion/mptbase.c +2 -0
index d733438..042bc86 100644
@@ -729,6 +729,8 @@ mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, u8 cb_idx)
 
 	/* call per pci device probe entry point */
 	list_for_each_entry(ioc, &ioc_list, list) {
+		if (!pci_get_drvdata(ioc->pcidev))
+			continue;
 		id = ioc->pcidev->driver ?
 		    ioc->pcidev->driver->id_table : NULL;
 		if (dd_cbfunc->probe)
maintainer
#1 lore raw
Quoted 10 lines · Sathya

This patch fixes a panic at mptctl_probe -> mutex_init if the mptsas and mptcl module are loaded in parallel, this is because IOC is NULL, the fix is in mpt_device_register to call probe only with non-zero IOC pointer.

---

drivers/message/fusion/mptbase.c +0 -0
index d733438..042bc86 100644

drivers/message/fusion/mptbase.c mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, u8 cb_idx) · line 733

Quoted 5 lines
drivers/message/fusion/mptbase.c +2 -0
@@ -729,6 +729,8 @@ mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, u8 cb_idx)
 
 	/* call per pci device probe entry point */
 	list_for_each_entry(ioc, &ioc_list, list) {
+		if (!pci_get_drvdata(ioc->pcidev))
+			continue;

This looks rather dubious ... it doesn't fix the race, it just manifests differently (and non fatally) by apparently not attaching the mptctl.

Isn't a better fix to set the drvdata earlier in the process, say in mpt_attach *before* you add the ioc to the ioc_list? That way the race can never occur in the first place.

James