Skip to content

Commit 067d946

Browse files
committed
ompi/request: Check for REQUEST_COMPLETED in threaded check
* It is possible for us to get to this selection statement with `tmp_sync` set to `REQUEST_COMPLETED` which causes a segv when we try to dereference that value inside `wait_sync_update`. So check against both `REQUEST_PENDING` and `REQUEST_COMPLETED` before attempting that function.
1 parent 019ca1e commit 067d946

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ompi/request/request.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ static inline int ompi_request_complete(ompi_request_t* request, bool with_signa
428428
ompi_wait_sync_t *tmp_sync = (ompi_wait_sync_t *) OPAL_ATOMIC_SWAP_PTR(&request->req_complete,
429429
REQUEST_COMPLETED);
430430
/* In the case where another thread concurrently changed the request to REQUEST_PENDING */
431-
if( REQUEST_PENDING != tmp_sync )
431+
if( REQUEST_PENDING != tmp_sync && REQUEST_COMPLETED != tmp_sync )
432432
wait_sync_update(tmp_sync, 1, request->req_status.MPI_ERROR);
433433
}
434434
} else

0 commit comments

Comments
 (0)