summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authoronexyoung <artem.bartel@gmail.com>2024-12-23 12:49:27 +0100
committerTomas Mraz <tomas@openssl.org>2025-01-17 11:36:26 +0100
commit8fb6c8154b552d0d7d8f160e7a6260f899b94263 (patch)
tree6b72075db56d767740f652a7d30f3755b7f77d57 /crypto
parentWorkaround for RSA on AArch64 Big Endian (diff)
downloadopenssl-8fb6c8154b552d0d7d8f160e7a6260f899b94263.tar.xz
openssl-8fb6c8154b552d0d7d8f160e7a6260f899b94263.zip
provider_deactivate(): Check return value of CRYPTO_atomic_add()
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/26249)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/provider_core.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/crypto/provider_core.c b/crypto/provider_core.c
index 1b16b27905..6b2a98524d 100644
--- a/crypto/provider_core.c
+++ b/crypto/provider_core.c
@@ -1111,7 +1111,14 @@ static int provider_deactivate(OSSL_PROVIDER *prov, int upcalls,
return -1;
}
- CRYPTO_atomic_add(&prov->activatecnt, -1, &count, prov->activatecnt_lock);
+ if (!CRYPTO_atomic_add(&prov->activatecnt, -1, &count, prov->activatecnt_lock)) {
+ if (lock) {
+ CRYPTO_THREAD_unlock(prov->flag_lock);
+ CRYPTO_THREAD_unlock(store->lock);
+ }
+ return -1;
+ }
+
#ifndef FIPS_MODULE
if (count >= 1 && prov->ischild && upcalls) {
/*