From 1c748dc8c0ad14b420de8d615953a17db4f9c2a8 Mon Sep 17 00:00:00 2001 From: Todd Kordenbrock Date: Mon, 12 Mar 2018 11:55:25 -0500 Subject: [PATCH] mtl-portals4: don't call progress() in finalize() if Portals4 was not initialized This commit fixes a segfault in mtl-portals4 finalize(). The segfault occurs if finalize() is called without any calls to add_procs(). This commit resolves the segfault by skipping the progress() loop in finalize() if the Portals was not initialized. Signed-off-by: Todd Kordenbrock (thkgcode@gmail.com) (cherry picked from commit 90659671bc038f8768794e7443f0ae4cd47c165a) --- ompi/mca/mtl/portals4/mtl_portals4.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ompi/mca/mtl/portals4/mtl_portals4.c b/ompi/mca/mtl/portals4/mtl_portals4.c index 2d25c8db7dd..5371a8be4dc 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4.c +++ b/ompi/mca/mtl/portals4/mtl_portals4.c @@ -548,8 +548,10 @@ ompi_mtl_portals4_del_procs(struct mca_mtl_base_module_t *mtl, int ompi_mtl_portals4_finalize(struct mca_mtl_base_module_t *mtl) { - opal_progress_unregister(ompi_mtl_portals4_progress); - while (0 != ompi_mtl_portals4_progress()) { } + if (0 == ompi_mtl_portals4.need_init) { + opal_progress_unregister(ompi_mtl_portals4_progress); + while (0 != ompi_mtl_portals4_progress()) { } + } #if OMPI_MTL_PORTALS4_FLOW_CONTROL ompi_mtl_portals4_flowctl_fini();