Skip to content

Commit d908244

Browse files
authored
Merge pull request #12480 from dalcinl/bugfix/ulfm-comm-req-ret
ulfm: Fix use-after-free in ishrink implementation
2 parents 8408033 + 573f35e commit d908244

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

ompi/communicator/ft/comm_ft.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,8 @@ int ompi_comm_ishrink_internal(ompi_communicator_t* comm, ompi_communicator_t**
489489
subreq,
490490
comm->c_coll->coll_iagree_module );
491491
if( OMPI_SUCCESS != rc ) {
492-
ompi_comm_request_return(request);
493492
OBJ_RELEASE(context->failed_group);
493+
ompi_comm_request_return(request);
494494
return rc;
495495
}
496496

@@ -523,8 +523,8 @@ static int ompi_comm_ishrink_check_agree(ompi_comm_request_t *request) {
523523
rc = request->super.req_status.MPI_ERROR;
524524
if( (OMPI_SUCCESS != rc) && (MPI_ERR_PROC_FAILED != rc) ) {
525525
opal_output(0, "%s:%d Agreement failure: %d\n", __FILE__, __LINE__, rc);
526-
ompi_comm_request_return(request);
527526
OBJ_RELEASE(context->failed_group);
527+
ompi_comm_request_return(request);
528528
return rc;
529529
}
530530

@@ -542,8 +542,8 @@ static int ompi_comm_ishrink_check_agree(ompi_comm_request_t *request) {
542542
subreq,
543543
comm->c_coll->coll_iagree_module );
544544
if( OMPI_SUCCESS != rc ) {
545-
ompi_comm_request_return(request);
546545
OBJ_RELEASE(context->failed_group);
546+
ompi_comm_request_return(request);
547547
return rc;
548548
}
549549
ompi_comm_request_schedule_append(request, ompi_comm_ishrink_check_agree, subreq, 1);
@@ -565,17 +565,17 @@ static int ompi_comm_ishrink_check_agree(ompi_comm_request_t *request) {
565565
comm_group = comm->c_local_group;
566566
rc = ompi_group_difference(comm_group, context->failed_group, &context->alive_group);
567567
if( OMPI_SUCCESS != rc ) {
568-
ompi_comm_request_return(request);
569568
OBJ_RELEASE(context->failed_group);
569+
ompi_comm_request_return(request);
570570
return rc;
571571
}
572572
if( OMPI_COMM_IS_INTER(comm) ) {
573573
comm_group = comm->c_remote_group;
574574
rc = ompi_group_difference(comm_group, context->failed_group, &context->alive_rgroup);
575575
if( OMPI_SUCCESS != rc ) {
576-
ompi_comm_request_return(request);
577576
OBJ_RELEASE(context->alive_group);
578577
OBJ_RELEASE(context->failed_group);
578+
ompi_comm_request_return(request);
579579
return rc;
580580
}
581581
}
@@ -595,11 +595,11 @@ static int ompi_comm_ishrink_check_agree(ompi_comm_request_t *request) {
595595
subreq
596596
);
597597
if( OMPI_SUCCESS != rc ) {
598-
ompi_comm_request_return(request);
599598
OBJ_RELEASE(context->alive_group);
600599
if( NULL != context->alive_rgroup ) {
601600
OBJ_RELEASE(context->alive_rgroup);
602601
}
602+
ompi_comm_request_return(request);
603603
return rc;
604604
}
605605

@@ -628,8 +628,8 @@ static int ompi_comm_ishrink_check_setrank(ompi_comm_request_t *request) {
628628
opal_output_verbose(1, ompi_ftmpi_output_handle,
629629
"%s ompi: comm_ishrink: Construction failed with error %d",
630630
OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), rc);
631-
ompi_comm_request_return(request);
632631
OBJ_RELEASE(*context->newcomm);
632+
ompi_comm_request_return(request);
633633
return rc;
634634
}
635635

@@ -663,8 +663,8 @@ static int ompi_comm_ishrink_check_setrank(ompi_comm_request_t *request) {
663663
mode, /* mode */
664664
subreq );
665665
if( OMPI_SUCCESS != rc ) {
666-
ompi_comm_request_return(request);
667666
OBJ_RELEASE(*context->newcomm);
667+
ompi_comm_request_return(request);
668668
return rc;
669669
}
670670

@@ -687,8 +687,8 @@ static int ompi_comm_ishrink_check_cid(ompi_comm_request_t *request) {
687687
opal_output_verbose(1, ompi_ftmpi_output_handle,
688688
"%s ompi: comm_ishrink: Determine context id failed with error %d",
689689
OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), rc);
690-
ompi_comm_request_return(request);
691690
OBJ_RELEASE(*context->newcomm);
691+
ompi_comm_request_return(request);
692692
return rc;
693693
}
694694
#if OPAL_ENABLE_DEBUG
@@ -724,8 +724,8 @@ static int ompi_comm_ishrink_check_cid(ompi_comm_request_t *request) {
724724
mode,
725725
subreq );
726726
if( OMPI_SUCCESS != rc ) {
727-
ompi_comm_request_return(request);
728727
OBJ_RELEASE(*context->newcomm);
728+
ompi_comm_request_return(request);
729729
return rc;
730730
}
731731

@@ -747,8 +747,8 @@ static int ompi_comm_ishrink_check_activate(ompi_comm_request_t *request) {
747747
opal_output_verbose(1, ompi_ftmpi_output_handle,
748748
"%s ompi: comm_ishrink: Activation failed with error %d",
749749
OMPI_NAME_PRINT(OMPI_PROC_MY_NAME), rc);
750-
ompi_comm_request_return(request);
751750
OBJ_RELEASE(*context->newcomm);
751+
ompi_comm_request_return(request);
752752
return rc;
753753
}
754754
#if OPAL_ENABLE_DEBUG

0 commit comments

Comments
 (0)