]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix CRYPTO_atomic_store
authorNeil Horman <nhorman@openssl.org>
Mon, 22 Jul 2024 21:17:54 +0000 (17:17 -0400)
committerNeil Horman <nhorman@openssl.org>
Wed, 31 Jul 2024 12:05:53 +0000 (08:05 -0400)
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 <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/24969)

crypto/threads_pthread.c

index 14b1dbf6c20ab66a0ea5628bcb2fdc266e3525f0..86943ba433674aed9308184d86b6e94a4a1233c0 100644 (file)
@@ -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))