[ofa-general] [PATCH] opensm/osm_mcast_mgr: limit spanning tree creation recursion to max hops (64)

Sasha Khapyorsky sashak at voltaire.com
Mon Mar 24 02:43:06 PDT 2008


This limits spanning tree building recursion to max hops enabled in IB
(64). Without it OpenSM crashes in endless recursion
(__osm_mcast_mgr_branch()) when lid matrices (min hop tables) are not
configured properly or broken for some reason (as example - using old
version of '--connect_roots' option with up/down on some topologies).

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

diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
index fe4cfbf..683a16d 100644
--- a/opensm/opensm/osm_mcast_mgr.c
+++ b/opensm/opensm/osm_mcast_mgr.c
@@ -569,6 +569,14 @@ static osm_mtree_node_t *__osm_mcast_mgr_branch(osm_sm_t * sm,
 
 	depth++;
 
+	if (depth >= 64) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
+			"Maximal hops number is reached MLID 0x%x."
+			" Break processing.", mlid_ho);
+		__osm_mcast_mgr_purge_list(sm, p_list);
+		goto Exit;
+	}
+
 	if (depth > *p_max_depth) {
 		CL_ASSERT(depth == *p_max_depth + 1);
 		*p_max_depth = depth;
-- 
1.5.4.rc2.60.gb2e62




More information about the general mailing list