[ofa-general] [PATCH] opensm/lash: fix possible segfault in osm_get_lash_sl()

Sasha Khapyorsky sashak at voltaire.com
Sat Jan 19 10:15:55 PST 2008


It is possible (and reproducible) that osm_get_lash_sl() is called
(via SA PathRecord query) when switch was discovered already by OpenSM
but yet not processed LASH and still has ->priv = NULL, it can happen
during subsequent heavy sweep somewhere between subnet discovery and
routing calculation phases of the sweep.

Pointed out by: Max Matveev <makc at sgi.com>

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_ucast_lash.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/opensm/opensm/osm_ucast_lash.c b/opensm/opensm/osm_ucast_lash.c
index c17046e..cf9d701 100644
--- a/opensm/opensm/osm_ucast_lash.c
+++ b/opensm/opensm/osm_ucast_lash.c
@@ -1429,7 +1429,7 @@ uint8_t osm_get_lash_sl(osm_opensm_t * p_osm, osm_port_t * p_src_port,
 		return OSM_DEFAULT_SL;
 
 	p_sw = get_osm_switch_from_port(p_dst_port);
-	if (!p_sw)
+	if (!p_sw || !p_sw->priv)
 		return OSM_DEFAULT_SL;
 	dst_id = get_lash_id(p_sw);
 
-- 
1.5.4.rc2.38.gd6da3




More information about the general mailing list