Skip to contentSkip to conversation

opensm/osm_torus.c: Fix crash in torus_update_osm_vlarb

PATCH In review Hal Rosenstock 2 participants 3 messages Dec 3, 2012 2 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opensm/osm_torus.c: Fix crash in torus_update_osm_vlarb

---
 opensm/osm_torus.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
opensm/osm_torus.c +1 -1
index c06f8d4..075f84a 100644
@@ -8089,7 +8089,7 @@ void torus_update_osm_vlarb(void *context, osm_physp_t *osm_phys_port,
 	 * So, leave VL 0 alone, remap VL 4 to VL 1, zero out the rest,
 	 * and compress out the zero entries to the end.
 	 */
-	if (!sw || !port_num ||
+	if (!sw || !port_num || sw->port[port_num] ||
 	    sw->port[port_num]->pgrp->port_grp != 2 * TORUS_MAX_DIM)
 		return;
  
Signature · 6 lines
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to a message not in the archive
Quoted 12 lines · Hal Rosenstock
---
  opensm/osm_torus.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
opensm/osm_torus.c +0 -0
index c06f8d4..075f84a 100644

opensm/osm_torus.c void torus_update_osm_vlarb(void *context, osm_physp_t *osm_phys_port, · line 8095

Quoted 8 lines
opensm/osm_torus.c +1 -1
@@ -8089,7 +8089,7 @@ void torus_update_osm_vlarb(void *context, osm_physp_t *osm_phys_port,
  	 * So, leave VL 0 alone, remap VL 4 to VL 1, zero out the rest,
  	 * and compress out the zero entries to the end.
  	 */
-	if (!sw || !port_num ||
+	if (!sw || !port_num || sw->port[port_num] ||
  	    sw->port[port_num]->pgrp->port_grp != 2 * TORUS_MAX_DIM)
  		return;
 

With the patch as-is, if torus_update_osm_vlarb() returns early for any non-NULL switch port, it will never do any updates.

If the crash was that sw->port[port_num] was NULL, shouldn't the check be !sw->port[port_num] ?

Can you tell me more about the test case that leads to the crash?

Is it that there's a switch with a port that's not connected to anything, and torus_update_osm_vlarb() was called for it?

Testing for a non-NULL sw->port[port_num] is definitely the right thing to do to handle that case, and I'm sorry I missed it earlier.

If not, then something else is likely broken, and we need to find and fix that.

-- Jim

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to a message not in the archive
Quoted 31 lines · Jim Schutt
Quoted 13 lines · Hal Rosenstock
---
  opensm/osm_torus.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
opensm/osm_torus.c +0 -0
index c06f8d4..075f84a 100644

opensm/osm_torus.c void torus_update_osm_vlarb(void *context, · line 8095

Quoted 8 lines
opensm/osm_torus.c +1 -1
@@ -8089,7 +8089,7 @@ void torus_update_osm_vlarb(void *context,
 osm_physp_t *osm_phys_port,
       * So, leave VL 0 alone, remap VL 4 to VL 1, zero out the rest,
       * and compress out the zero entries to the end.
       */
-    if (!sw || !port_num ||
+    if (!sw || !port_num || sw->port[port_num] ||
          sw->port[port_num]->pgrp->port_grp != 2 * TORUS_MAX_DIM)
          return;

With the patch as-is, if torus_update_osm_vlarb() returns early for any non-NULL switch port, it will never do any updates.

If the crash was that sw->port[port_num] was NULL, shouldn't the check be !sw->port[port_num] ?

Can you tell me more about the test case that leads to the crash?

Quoted 8 lines

Is it that there's a switch with a port that's not connected to anything, and torus_update_osm_vlarb() was called for it?

Testing for a non-NULL sw->port[port_num] is definitely the right thing to do to handle that case, and I'm sorry I missed it earlier.

If not, then something else is likely broken, and we need to find and fix that.

Yes, it was meant to be NULL pointer check. v2 of patch coming soon.

-- Hal

Quoted 4 lines

-- Jim

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html