[openib-general] [osm] segfault in libibumad

Hal Rosenstock halr at voltaire.com
Fri Jun 10 12:22:32 PDT 2005


On Fri, 2005-06-10 at 14:50, Bernhard Fischer wrote:
> Hi,
> 
> I have no ib drivers loaded, starting opensm fails with a segfault.
> 
> I'm not sure if userspace is supposed to work without sysfs. What do
> you think?

It shouldn't segv...

> In osm_vendor_init(), i'd set int r = -1, n_cas = -1; and would say
> else\nif ((n_cas = umad_get_cas_names.
> Also, in umad_get_cas_names() i guess only freeing namelist if
> scandir did not return <0 may be better..

Yes to both.

> (gdb) run
> Starting program: /opt/infiniband/ib/bin/opensm
> -------------------------------------------------
> OpenSM Rev:openib-1.0.0
> Command Line Arguments:
>  Log File: /var/log/osm.log
> -------------------------------------------------
> warn: [5900] umad_init: can't read ABI version from
> /sys/class/infiniband_mad/abi_version (No such file or directory): is
> ib_umad module loaded?
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x400b8735 in free () from /lib/tls/libc.so.6
> (gdb) bt
> #0  0x400b8735 in free () from /lib/tls/libc.so.6
> #1  0x4002235a in umad_get_cas_names (cas=0x80acc1c, max=32) at
> umad.c:513
> #2  0x4001afe1 in osm_vendor_init (p_vend=0x80acb88, p_log=0x80a979c,
>     timeout=100) at osm_vendor_ibumad.c:418
> #3  0x4001b0ba in osm_vendor_new (p_log=0x80a979c, timeout=100)
>     at osm_vendor_ibumad.c:452
> #4  0x0805d2e4 in osm_opensm_init (p_osm=0x80a8520, p_opt=0xbfb5dc40)
>     at osm_opensm.c:234
> #5  0x0804ca19 in main (argc=1, argv=0xbfb5de14) at main.c:632

Can you try this patch ? Thanks.

-- Hal

Index: libibumad/src/umad.c
===================================================================
--- libibumad/src/umad.c	(revision 2580)
+++ libibumad/src/umad.c	(working copy)
@@ -511,7 +511,8 @@
 		DEBUG("return 1 ca");
 		j = 1;
 	}
-	free(namelist);
+	if (n >= 0)
+		free(namelist);
 	return j;
 }
 	
Index: osm/libvendor/osm_vendor_ibumad.c
===================================================================
--- osm/libvendor/osm_vendor_ibumad.c	(revision 2580)
+++ osm/libvendor/osm_vendor_ibumad.c	(working copy)
@@ -405,7 +405,8 @@
 			"osm_vendor_init: umad_get_cas_names failed\n");
 		r = n_cas;
 		goto Exit;
-	}
+	} else
+		r = n_cas = -1;
 
 	p_vend->ca_count = n_cas;
 	p_vend->mtbl.max = OSM_UMAD_MAX_PENDING;






More information about the general mailing list