From 4084e25466d4797f016efde548aedcf5c5ec00e7 Mon Sep 17 00:00:00 2001 From: eitan Date: Tue, 4 Apr 2006 08:53:53 +0000 Subject: [PATCH] OpenSM: trivial fix for segfault on invalid port info A previous patch adding explicit set remote port state DOWN in case the local one is recycled was not safe. In the case of irresponsive remote port, it would actually try and traverse a null pointer of the port info. This simple fix is just a little more careful about it. p_rem_port was also renamed to p_rem_physp as the pointer actually points to a physical port... Signed-off-by: Eitan Zahavi git-svn-id: svn://openib.tc.cornell.edu/gen1@279 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- trunk/ulp/opensm/user/opensm/osm_lid_mgr.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/trunk/ulp/opensm/user/opensm/osm_lid_mgr.c b/trunk/ulp/opensm/user/opensm/osm_lid_mgr.c index 2f0752fd..22b3a534 100644 --- a/trunk/ulp/opensm/user/opensm/osm_lid_mgr.c +++ b/trunk/ulp/opensm/user/opensm/osm_lid_mgr.c @@ -917,13 +917,18 @@ __osm_lid_mgr_set_remote_pi_state_to_init( IN osm_physp_t* const p_physp) { ib_port_info_t *p_pi; - osm_physp_t *p_rem_port = osm_physp_get_remote(p_physp); + osm_physp_t *p_rem_physp = osm_physp_get_remote(p_physp); - CL_ASSERT(p_rem_port); + CL_ASSERT(p_rem_physp); - p_pi = osm_physp_get_port_info_ptr( p_rem_port ); + if (osm_physp_is_valid( p_rem_physp )) + { + p_pi = osm_physp_get_port_info_ptr( p_rem_physp ); + /* but in some rare cases the remote side might be irresponsive */ + if (p_pi) ib_port_info_set_port_state( p_pi, IB_LINK_INIT ); } +} /********************************************************************** **********************************************************************/ -- 2.41.0