Skip to content

Commit fc025c7

Browse files
committed
UCX: do not dereference NULL pointer in wpmem_[free|flush]
Flushing or freeing a newly created dynamic window causes NULL to be passed. Signed-off-by: Joseph Schuchart <schuchart@hlrs.de>
1 parent 560ebc5 commit fc025c7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

opal/mca/common/ucx/common_ucx_wpool.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,10 @@ static int _comm_ucx_wpmem_map(opal_common_ucx_wpool_t *wpool,
528528
void opal_common_ucx_wpmem_free(opal_common_ucx_wpmem_t *mem)
529529
{
530530
_mem_record_t *mem_rec = NULL, *next;
531+
532+
if (NULL == mem) {
533+
return;
534+
}
531535

532536
OBJ_DESTRUCT(&mem->tls_key);
533537

@@ -824,9 +828,14 @@ opal_common_ucx_wpmem_flush(opal_common_ucx_wpmem_t *mem,
824828
int target)
825829
{
826830
_ctx_record_t *ctx_rec;
827-
opal_common_ucx_ctx_t *ctx = mem->ctx;
831+
opal_common_ucx_ctx_t *ctx;
828832
int rc = OPAL_SUCCESS;
829833

834+
if (NULL == mem) {
835+
return OPAL_SUCCESS;
836+
}
837+
838+
ctx = mem->ctx;
830839
opal_mutex_lock(&ctx->mutex);
831840

832841
OPAL_LIST_FOREACH(ctx_rec, &ctx->ctx_records, _ctx_record_t) {

0 commit comments

Comments
 (0)