diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-03-18 13:04:30 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-03-19 14:25:00 +0100 |
commit | 03cd9d2f230fd60af23ed5ccbe8c6e8ad245cd73 (patch) | |
tree | 2525aa42d3911f2cd2558a21555dbdee2c0d5be5 /crypto/async | |
parent | 0e2f87c03e1a288f5f58627b373a25f83c59318a (diff) |
ASYNC_start_job: Reset libctx when async_fibre_swapcontext fails
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14605)
Diffstat (limited to 'crypto/async')
-rw-r--r-- | crypto/async/async.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; } |