[ofa-general] Re: [PATCH] opensm/osm_switch.c: In osm_switch_delete, set priv to NULL

Sasha Khapyorsky sashak at voltaire.com
Mon Jul 27 09:32:28 PDT 2009


Hi Hal,

On 19:04 Fri 24 Jul     , Hal Rosenstock wrote:
> 
> This can help with finding use after free issues if memory not reused
> updn and lash rely on this priv pointer and may have stale
> osm_switch_t pointers

As far as I remember LASH and UPDN should never be in this state. If you
are able to see such cases this indicates some serious bug (probably
race between SA PR processor and drop manager if it happens with LASH)
and actually is a good environment for finding and fixing.

The proposed patch is just hide a *real* problem (unless I'm wrong
above and the case is legal).

Sasha

> 
> Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
> ---
> diff --git a/opensm/opensm/osm_switch.c b/opensm/opensm/osm_switch.c
> index ce1ca63..e23b32f 100644
> --- a/opensm/opensm/osm_switch.c
> +++ b/opensm/opensm/osm_switch.c
> @@ -94,6 +94,7 @@ void osm_switch_delete(IN OUT osm_switch_t ** const pp_sw)
>  				free(p_sw->hops[i]);
>  		free(p_sw->hops);
>  	}
> +	p_sw->priv = NULL;
>  	free(*pp_sw);
>  	*pp_sw = NULL;
>  }
> 



More information about the general mailing list