[ofa-general] Re: [PATCH] opensm/osm_ucast_lash.c: Eliminate possible seg fault in get_osm_switch_from_port

Hal Rosenstock hal.rosenstock at gmail.com
Mon Jul 13 03:13:41 PDT 2009


Hi Sasha,

On Sun, Jul 12, 2009 at 8:11 PM, Sasha Khapyorsky<sashak at voltaire.com> wrote:
> Hi Hal,
>
> On 07:48 Sat 11 Jul     , Hal Rosenstock wrote:
>>
>> get_osm_switch_from_port can be called with NULL port pointer
>> from osm_get_lash_sl
>>
>> Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
>> ---
>> diff --git a/opensm/opensm/osm_ucast_lash.c b/opensm/opensm/osm_ucast_lash.c
>> index 12b5e34..871a673 100644
>> --- a/opensm/opensm/osm_ucast_lash.c
>> +++ b/opensm/opensm/osm_ucast_lash.c
>> @@ -5,6 +5,7 @@
>>   * Copyright (c) 2007      Simula Research Laboratory. All rights reserved.
>>   * Copyright (c) 2007      Silicon Graphics Inc. All rights reserved.
>>   * Copyright (c) 2008,2009 System Fabric Works, Inc. All rights reserved.
>> + * Copyright (c) 2009      HNR Consulting. All rights reserved.
>>   *
>>   * This software is available to you under a choice of one of two
>>   * licenses.  You may choose to be licensed under the terms of the GNU
>> @@ -129,7 +130,11 @@ static void connect_switches(lash_t * p_lash, int sw1, int sw2, int phy_port_1)
>>
>>  static osm_switch_t *get_osm_switch_from_port(const osm_port_t * port)
>>  {
>> -     osm_physp_t *p = port->p_physp;
>> +     osm_physp_t *p;
>> +
>> +     if (!port)
>> +             return NULL;
>
> When such *legal* get_osm_switch_from_port() call with port = NULL is
> possible?

It's called with NULL port pointer from osm_get_lash_sl which is
invoked via SA PathRecord flow.

-- Hal

> Sasha
>
>> +     p = port->p_physp;
>>       if (p->p_node->sw)
>>               return p->p_node->sw;
>>       else if (p->p_remote_physp->p_node->sw)
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
>
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
>



More information about the general mailing list