The branch master has been updated via 03cd9d2f230fd60af23ed5ccbe8c6e8ad245cd73 (commit) from 0e2f87c03e1a288f5f58627b373a25f83c59318a (commit)
- Log ----------------------------------------------------------------- commit 03cd9d2f230fd60af23ed5ccbe8c6e8ad245cd73 Author: Tomas Mraz <to...@openssl.org> Date: Thu Mar 18 13:04:30 2021 +0100 ASYNC_start_job: Reset libctx when async_fibre_swapcontext fails Reviewed-by: Matt Caswell <m...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14605) ----------------------------------------------------------------------- Summary of changes: crypto/async/async.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crypto/async/async.c b/crypto/async/async.c index 963d969d98..2a51ee7bc2 100644 --- a/crypto/async/async.c +++ b/crypto/async/async.c @@ -209,9 +209,15 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret, * fibre ran */ libctx = OSSL_LIB_CTX_set0_default(ctx->currjob->libctx); + if (libctx == NULL) { + /* Failed to set the default context */ + ERR_raise(ERR_LIB_ASYNC, ERR_R_INTERNAL_ERROR); + goto err; + } /* Resume previous job */ if (!async_fibre_swapcontext(&ctx->dispatcher, &ctx->currjob->fibrectx, 1)) { + ctx->currjob->libctx = OSSL_LIB_CTX_set0_default(libctx); ERR_raise(ERR_LIB_ASYNC, ASYNC_R_FAILED_TO_SWAP_CONTEXT); goto err; }