]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
IB extension: segfault in create collective group with non-vector type IA handle"
authorArlin Davis <arlin.r.davis@intel.com>
Wed, 2 Jul 2014 21:49:53 +0000 (14:49 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Wed, 2 Jul 2014 21:49:53 +0000 (14:49 -0700)
The dats_get_ia_handle call was change in 2.0.34 to convert IA handle from
both vector to handle and handle to vector to fix query calls that
incorrectly returned IA handles in non-vector form. If a caller uses a
non vector IA handle it will get converted incorrectly to a vector and cause
a segfault. Add additional check to verify a IA handle type before calling
get ia handle to avoid incorrect translation.

Signed-off-by: Arlin Davis <arlin.r.davis@intel.com>
dat/common/dat_api.c

index a4d77d26964380197db7b1c8b2cb30ec870bfc32..0c28c110cde1006895b8759c96cccad1d878c9d2 100755 (executable)
@@ -1082,7 +1082,7 @@ extern DAT_RETURN udat_extension_close(IN const DAT_NAME_PTR name,
 
 /* Consumer API - dat_extension_op()
  *
- * Handle == IA, EP, EVD, etc
+ * Handle  == IA, EP, EVD, etc
  * !Handle == direct extension operation to provider without device open
  *           provider name supplied for linkage to library
  *
@@ -1091,16 +1091,19 @@ DAT_RETURN DAT_API dat_extension_op(IN DAT_HANDLE handle,
                                    IN DAT_EXTENDED_OP ext_op, IN ...)
 {
        DAT_RETURN status;
-       DAT_IA_HANDLE dapl_handle;
+       DAT_IA_HANDLE dapl_handle = handle;
        va_list args;
 
        dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API,
                         " dat_extension_op: (handle %p, op %d) called\n",
                         handle, ext_op);
 
-       /* If not IA handle then just passthrough */
-       if (dats_get_ia_handle(handle, &dapl_handle) != DAT_SUCCESS)
-               dapl_handle = handle;
+       /* only convert if ia_handle vector */
+       if (handle && dats_is_ia_handle(handle)) {
+               if (dats_get_ia_handle(handle, &dapl_handle))
+                       return DAT_ERROR(DAT_INVALID_HANDLE,
+                                        DAT_INVALID_HANDLE1);
+       }
 
        dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API,
                         " dat_extension_op: dapl_handle %p \n", handle);