From 4b293d3823ee682491d1e663d45b664ef9b0ccf2 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Tue, 11 Dec 2018 21:23:24 +0000 Subject: [PATCH] mtl/ofi: Fix crash if no providers found Commit 109d0569ffd introduced a crash when an error occurred before ofi_ctxt was allocated, including when no providers passed the selection logic. Properly check that the pointer is not NULL in the error cleanup code before dereferencing the pointer. Signed-off-by: Brian Barrett (cherry picked from commit 6e15128d960aaa40dd7e905ae3e9e53d9cdaac2a) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/mtl_ofi_component.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 8856db0798..a9f1ea00e4 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -927,6 +927,7 @@ error: (void) fi_close((fid_t)ompi_mtl_ofi.av); } if ((false == ompi_mtl_ofi.sep_supported) && + ompi_mtl_ofi.ofi_ctxt != NULL && ompi_mtl_ofi.ofi_ctxt[0].cq) { /* Check if CQ[0] was created for non-SEP case and close if needed */ (void) fi_close((fid_t)ompi_mtl_ofi.ofi_ctxt[0].cq);