[openib-general] [PATCH] osm: trivial fix segfault on invalid port info
Eitan Zahavi
eitan at mellanox.co.il
Thu Mar 30 02:40:49 PST 2006
Hi Hal
A previous patch adding explicit set remote port state DOWN in case the
local one is recycled was not safe. In a 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.
I also renamed the p_rem_port to p_rem_physp as the pointer actually
points to a physical port...
Eitan
Signed-off-by: Eitan Zahavi <eitan at mellanox.co.il>
Index: opensm/osm_lid_mgr.c
===================================================================
--- opensm/osm_lid_mgr.c (revision 6076)
+++ opensm/osm_lid_mgr.c (working copy)
@@ -920,13 +920,18 @@ __osm_lid_mgr_set_remote_pi_state_to_ini
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 on some rare cases the remote side might be irresponsive */
+ if (p_pi)
ib_port_info_set_port_state( p_pi, IB_LINK_INIT );
}
+}
/**********************************************************************
**********************************************************************/
More information about the general
mailing list