diff options
author | cchinchole <cpchinchole@gmail.com> | 2024-07-02 09:56:22 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-07-03 16:04:53 +0200 |
commit | e6174ca4d48f6f4f954dd87f2cdf3718af14f064 (patch) | |
tree | 5759a8fd4a8e38a6ba737492bdb39a19e4c0b24d /crypto/engine | |
parent | Configure: Remove -Wswitch-default from strict warnings (diff) | |
download | openssl-e6174ca4d48f6f4f954dd87f2cdf3718af14f064.tar.xz openssl-e6174ca4d48f6f4f954dd87f2cdf3718af14f064.zip |
Fixes for potential deadlock
Fixes (#24517):
(3/3) Addresses the potential deadlock if an error occurs from up_ref
in functions ENGINE_get_first, ENGINE_get_last, ENGINE_get_next, and
ENGINE_get_prev in file crypto/engine/eng_list.c
CLA: trivial
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24780)
Diffstat (limited to 'crypto/engine')
-rw-r--r-- | crypto/engine/eng_list.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/engine/eng_list.c b/crypto/engine/eng_list.c index a2c151d64a..eafca3ec49 100644 --- a/crypto/engine/eng_list.c +++ b/crypto/engine/eng_list.c @@ -243,6 +243,7 @@ ENGINE *ENGINE_get_first(void) int ref; if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) { + CRYPTO_THREAD_unlock(global_engine_lock); ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB); return NULL; } @@ -269,6 +270,7 @@ ENGINE *ENGINE_get_last(void) int ref; if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) { + CRYPTO_THREAD_unlock(global_engine_lock); ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB); return NULL; } @@ -294,6 +296,7 @@ ENGINE *ENGINE_get_next(ENGINE *e) /* Return a valid structural reference to the next ENGINE */ if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) { + CRYPTO_THREAD_unlock(global_engine_lock); ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB); return NULL; } @@ -320,6 +323,7 @@ ENGINE *ENGINE_get_prev(ENGINE *e) /* Return a valid structural reference to the next ENGINE */ if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) { + CRYPTO_THREAD_unlock(global_engine_lock); ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB); return NULL; } |