summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorNeil Horman <nhorman@openssl.org>2024-02-29 09:49:37 -0500
committerPauli <ppzgs1@gmail.com>2024-04-24 12:03:03 +1000
commitf39a86281883bd7ff0b3791ed203756d055c001b (patch)
tree38a7451ab965145b566dc8088b6e3722935733a5 /crypto
parent3bcac46035d16e777c6651c18078bbcab27ad17a (diff)
Fix list appending in win ossl_rcu_call
The ossl_rcu_call function for windows creates a linked list loop. fix it to work like the pthread version properly Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23671)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/threads_pthread.c4
-rw-r--r--crypto/threads_win.c5
2 files changed, 1 insertions, 8 deletions
diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c
index 33e225b995..69b68e5226 100644
--- a/crypto/threads_pthread.c
+++ b/crypto/threads_pthread.c
@@ -581,10 +581,6 @@ void ossl_synchronize_rcu(CRYPTO_RCU_LOCK *lock)
uint64_t count;
struct rcu_cb_item *cb_items, *tmpcb;
- /*
- * __ATOMIC_ACQ_REL is used here to ensure that we get any prior published
- * writes before we read, and publish our write immediately
- */
pthread_mutex_lock(&lock->write_lock);
cb_items = lock->cb_items;
lock->cb_items = NULL;
diff --git a/crypto/threads_win.c b/crypto/threads_win.c
index 873b2bd78c..6bcbaea10f 100644
--- a/crypto/threads_win.c
+++ b/crypto/threads_win.c
@@ -357,17 +357,14 @@ void ossl_synchronize_rcu(CRYPTO_RCU_LOCK *lock)
int ossl_rcu_call(CRYPTO_RCU_LOCK *lock, rcu_cb_fn cb, void *data)
{
struct rcu_cb_item *new;
- struct rcu_cb_item *prev;
new = OPENSSL_zalloc(sizeof(struct rcu_cb_item));
if (new == NULL)
return 0;
- prev = new;
new->data = data;
new->fn = cb;
- InterlockedExchangePointer((void * volatile *)&lock->cb_items, prev);
- new->next = prev;
+ new->next = InterlockedExchangePointer((void * volatile *)&lock->cb_items, new);
return 1;
}