Skip to contentSkip to conversation

mpt fusion: don't oops if NumPhys==0

PATCH Applied [email protected] 2 participants 2 messages Mar 4, 2008

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

PATCH 1/2 mpt fusion: don't oops if NumPhys==0

From: Krzysztof Oledzki <[email protected]>

Don't oops if NumPhys==0, instead return -ENODEV.
This patch fixes http://bugzilla.kernel.org/show_bug.cgi?id=9909

Cc FUJITA Tomonori <[email protected]>
Cc James Bottomley <[email protected]>
Cc Eric Moore <[email protected]>
Cc Sathya Prakash <[email protected]>

---

 drivers/message/fusion/mptsas.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/message/fusion/mptsas.c renamed from drivers/message/fusion/mptsas.c~mpt-fusion-dont-oops-if-numphys==0 +5 -0
diff -puN drivers/message/fusion/mptsas.c~mpt-fusion-dont-oops-if-numphys==0 drivers/message/fusion/mptsas.c
@@ -1701,6 +1701,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc
 	if (error)
 		goto out_free_consistent;
 
+	if (!buffer->NumPhys) {
+		error = -ENODEV;
+		goto out_free_consistent;
+	}
+
 	/* save config data */
 	port_info->num_phys = buffer->NumPhys;
 	port_info->phy_info = kcalloc(port_info->num_phys,

_

#1 lore raw
Quoted 35 lines · Andrew Morton

From: Krzysztof Oledzki <[email protected]>

Don't oops if NumPhys==0, instead return -ENODEV.
This patch fixes http://bugzilla.kernel.org/show_bug.cgi?id=9909

Cc FUJITA Tomonori <[email protected]>
Cc James Bottomley <[email protected]>
Cc Eric Moore <[email protected]>
Cc Sathya Prakash <[email protected]>

---

 drivers/message/fusion/mptsas.c |    5 +++++
 1 file changed, 5 insertions(+)

diff -puN drivers/message/fusion/mptsas.c~mpt-fusion-dont-oops-if-numphy s==0 drivers/message/fusion/mptsas.c
---
a/drivers/message/fusion/mptsas.c~mpt-fusion-dont-oops-if-numphys==0 +++ a/drivers/message/fusion/mptsas.c

drivers/message/fusion/mptsas.c renamed from drivers/message/fusion/mptsas.c~mpt-fusion-dont-oops-if-numphys==0 +5 -0
@@ -1701,6 +1701,11 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc
 	if (error)
 		goto out_free_consistent;
 
+	if (!buffer->NumPhys) {
+		error = -ENODEV;
+		goto out_free_consistent;
+	}
+
 	/* save config data */
 	port_info->num_phys = buffer->NumPhys;
 	port_info->phy_info = kcalloc(port_info->num_phys,
Quoted 2 lines

_

This patch seems fine, and we already have this patch in our internal sources. The reason your getting a zero phy count, that is you've got an expander that is zoned to initator A, and initiator B doesn't not have access to those phys hence why its receiving a zero phy count. Ulitmately I have an solution in my next generation driver, in that is I keep the sas address of the expander at a higher level above the phys struct. For this driver, what I propose is we create a phy[0] which really isn't there, and its merely storing the sas_address, but doing this, the expander can be added to the sas transport layer. The driver already has assumptoins that phy 0 will always be there. With only the patch above, the expander doesn't get added.

Eric