]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Access cb_items under write_lock in ossl_synchronize_rcu
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 17 Feb 2025 04:53:09 +0000 (05:53 +0100)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 17 Feb 2025 05:22:16 +0000 (06:22 +0100)
Fixes: 74a52ca9b793 "Don't use __ATOMIC_ACQ_REL on older compilers"
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26790)

crypto/threads_pthread.c

index 2e2e612121420c2a05fa0c53b54c25c7f94dd8bf..06f1ea8855ef20387e2db956827ed1c3aa170b8a 100644 (file)
@@ -514,12 +514,10 @@ void ossl_synchronize_rcu(CRYPTO_RCU_LOCK *lock)
     uint32_t curr_id;
     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
-     */
-    cb_items = ATOMIC_EXCHANGE_N(prcu_cb_item, &lock->cb_items, NULL,
-                                 __ATOMIC_ACQ_REL);
+    pthread_mutex_lock(&lock->write_lock);
+    cb_items = lock->cb_items;
+    lock->cb_items = NULL;
+    pthread_mutex_unlock(&lock->write_lock);
 
     qp = update_qp(lock, &curr_id);