From c1eb23352f44aec6faeef37d8f0c3180f6259cf8 Mon Sep 17 00:00:00 2001 From: Arlin Davis Date: Tue, 22 Apr 2008 12:55:13 -0700 Subject: [PATCH] dapl: evd_alloc doesn't check for direct_object_create errors. Fix error check in dapls_ib_wait_object_create() and dat_evd_alloc. When attempting to create large number of evd's that exceed open files limit the error was not propagated up causing a segfault. Note: there are 3 FD's required for each EVD 2 for pipe, and one for cq event_channel. Change the error reporting to indicate correct return code and send to log with non-debug builds. Signed-off by: Arlin Davis ardavis@ichips.intel.com --- dapl/common/dapl_evd_util.c | 5 +++++ dapl/openib_cma/dapl_ib_cq.c | 4 ++-- dapl/openib_cma/dapl_ib_util.h | 4 +--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dapl/common/dapl_evd_util.c b/dapl/common/dapl_evd_util.c index 2ae1b59..32fbaba 100755 --- a/dapl/common/dapl_evd_util.c +++ b/dapl/common/dapl_evd_util.c @@ -301,6 +301,11 @@ dapls_evd_alloc ( ((evd_flags & ~ (DAT_EVD_DTO_FLAG|DAT_EVD_RMR_BIND_FLAG)) == 0 )) { dapls_ib_wait_object_create (evd_ptr, &evd_ptr->cq_wait_obj_handle); + if (evd_ptr->cq_wait_obj_handle == NULL) { + dapl_os_free(evd_ptr, sizeof (DAPL_EVD)); + evd_ptr = NULL; + goto bail; + } } #endif diff --git a/dapl/openib_cma/dapl_ib_cq.c b/dapl/openib_cma/dapl_ib_cq.c index f63c9a7..d7b3309 100755 --- a/dapl/openib_cma/dapl_ib_cq.c +++ b/dapl/openib_cma/dapl_ib_cq.c @@ -239,7 +239,7 @@ dapls_ib_cq_alloc(IN DAPL_IA *ia_ptr, channel, 0); if (evd_ptr->ib_cq_handle == IB_INVALID_HANDLE) - return DAT_INSUFFICIENT_RESOURCES; + return(dapl_convert_errno(errno,"create_cq")); /* arm cq for events */ dapls_set_cq_notify(ia_ptr, evd_ptr); @@ -458,7 +458,7 @@ dapls_ib_wait_object_create(IN DAPL_EVD *evd_ptr, bail: dapl_os_free(*p_cq_wait_obj_handle, sizeof(struct _ib_wait_obj_handle)); - + *p_cq_wait_obj_handle = NULL; return(dapl_convert_errno(errno," wait_object_create")); } diff --git a/dapl/openib_cma/dapl_ib_util.h b/dapl/openib_cma/dapl_ib_util.h index 370f3b1..71593fd 100755 --- a/dapl/openib_cma/dapl_ib_util.h +++ b/dapl/openib_cma/dapl_ib_util.h @@ -305,11 +305,9 @@ dapl_convert_errno( IN int err, IN const char *str ) { if (!err) return DAT_SUCCESS; -#if DAPL_DBG if ((err != EAGAIN) && (err != ETIME) && (err != ETIMEDOUT) && (err != EINTR)) - dapl_dbg_log (DAPL_DBG_TYPE_ERR," %s %s\n", str, strerror(err)); -#endif + dapl_log (DAPL_DBG_TYPE_ERR," %s %s\n", str, strerror(err)); switch( err ) { -- 2.46.0