Skip to content

Commit 7abb14b

Browse files
authored
Merge pull request #10467 from joshfisher-cornelisnetworks/josh_main
opal: Segfault avoidence in mca/btl/ofi
2 parents 59928bb + 26d0201 commit 7abb14b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

opal/mca/btl/ofi/btl_ofi_component.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,10 @@ static int mca_btl_ofi_init_device(struct fi_info *info)
625625

626626
/* if the contexts have not been initiated, num_contexts should
627627
* be zero and we skip this. */
628-
for (int i = 0; i < module->num_contexts; i++) {
629-
mca_btl_ofi_context_finalize(&module->contexts[i], module->is_scalable_ep);
628+
if (NULL != module->contexts) {
629+
for (int i = 0; i < module->num_contexts; i++) {
630+
mca_btl_ofi_context_finalize(&module->contexts[i], module->is_scalable_ep);
631+
}
630632
}
631633
free(module->contexts);
632634

opal/mca/btl/ofi/btl_ofi_context.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ void mca_btl_ofi_context_finalize(mca_btl_ofi_context_t *context, bool scalable_
264264
}
265265

266266
/* Can we destruct the object that hasn't been constructed? */
267-
OBJ_DESTRUCT(&context->rdma_comp_list);
267+
if (context->rdma_comp_list.fl_num_allocated != 0){
268+
OBJ_DESTRUCT(&context->rdma_comp_list);
269+
}
268270

269271
if (TWO_SIDED_ENABLED) {
270272
OBJ_DESTRUCT(&context->frag_comp_list);

0 commit comments

Comments
 (0)