From 3190f5c06bd23ae4ddc659409e77070a6caa1539 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Mon, 22 Jul 2024 17:17:54 -0400 Subject: [PATCH] Fix CRYPTO_atomic_store If the implementation of this function falls to using a pthread lock to update a value, it should be a write lock, not a read lock Reviewed-by: Tomas Mraz Reviewed-by: Tom Cosgrove (Merged from https://github.com/openssl/openssl/pull/24969) --- crypto/threads_pthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c index 14b1dbf6c20..86943ba4336 100644 --- a/crypto/threads_pthread.c +++ b/crypto/threads_pthread.c @@ -994,7 +994,7 @@ int CRYPTO_atomic_store(uint64_t *dst, uint64_t val, CRYPTO_RWLOCK *lock) return 1; } # endif - if (lock == NULL || !CRYPTO_THREAD_read_lock(lock)) + if (lock == NULL || !CRYPTO_THREAD_write_lock(lock)) return 0; *dst = val; if (!CRYPTO_THREAD_unlock(lock)) -- 2.47.2