[ofa-general] Re: osm_link_mgr.c:link_mgr_get_smsl question

Sasha Khapyorsky sashak at voltaire.com
Sat Aug 29 13:45:08 PDT 2009


Hi Hal,

On 14:38 Fri 07 Aug     , Hal Rosenstock wrote:
> 
> osm_link_mgr.c:link_mgr_get_smsl has the following:
> 
>         /* Find osm_port of the source = p_physp */
>         slid = osm_physp_get_base_lid(p_physp);
>         p_src_port =
>             cl_ptr_vector_get(&sm->p_subn->port_lid_tbl, cl_ntoh16(slid));
> 
>         /* Call lash to find proper SL */
>         sl = osm_get_lash_sl(p_osm, p_src_port, p_sm_port);
> 
> It may be that this code is invoked prior to the LID being assigned

How is it possible? In the code I can see that link_mgr_process() is
always executed after lid_mgr run.

> so
> getting the p_src_port based on the LID yields NULL and then calling
> osm_get_lash_sl causes a seg fault.
> 
> I can see two ways to fix this:
> 1. Replace with port GUID search
> 2. Have osm_get_lash_sl handle NULL for p_src_port
> Maybe you see other ways to deal with this.
> 
> Do you have a preferred approach ?

Hmm, SMSL will be irrelevant for a port where LID was not assigned,
right?

If so than it is probably just enough to add in link_mgr_get_smsl():

	if (!p_src_port)
		return;

But it would be really better to understand an error source before
deciding about proper solution.

Sasha



More information about the general mailing list