diff options
author | Neil Horman <nhorman@openssl.org> | 2023-11-03 12:12:38 -0400 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-11-08 15:56:35 +0100 |
commit | b4cf49cb634d283abffaaec6db682af9eeae3261 (patch) | |
tree | 5f6fef53a0725dbff67f0a3a414df7c861e15eb2 | |
parent | 2f563dc3efa7ece9197aaf44cf099bf516ac7421 (diff) |
Correct order of ossl_condvar_signal in quic_multistream_test
quic_multistream test was issuing a signal on a condvar after dropping
the corresponding mutex, not before, leading to potential race
conditions in the reading of the associated data
Fixes #22588
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22616)
(cherry picked from commit 22b482a8b6f0c0e422c9b926c26d906ac6909106)
-rw-r--r-- | test/quic_multistream_test.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c index 8d513d7f08..22a753ad67 100644 --- a/test/quic_multistream_test.c +++ b/test/quic_multistream_test.c @@ -497,8 +497,8 @@ static int join_server_thread(struct helper *h) ossl_crypto_mutex_lock(h->server_thread.m); h->server_thread.stop = 1; - ossl_crypto_mutex_unlock(h->server_thread.m); ossl_crypto_condvar_signal(h->server_thread.c); + ossl_crypto_mutex_unlock(h->server_thread.m); ossl_crypto_thread_native_join(h->server_thread.t, &rv); ossl_crypto_thread_native_clean(h->server_thread.t); @@ -1079,8 +1079,8 @@ static int run_script_worker(struct helper *h, const struct script_op *script, else if (h->blocking && !h->server_thread.ready) { ossl_crypto_mutex_lock(h->server_thread.m); h->server_thread.ready = 1; - ossl_crypto_mutex_unlock(h->server_thread.m); ossl_crypto_condvar_signal(h->server_thread.c); + ossl_crypto_mutex_unlock(h->server_thread.m); } if (h->blocking) assert(h->s == NULL); @@ -2658,8 +2658,8 @@ static int script_20_trigger(struct helper *h, volatile uint64_t *counter) #if defined(OPENSSL_THREADS) ossl_crypto_mutex_lock(h->misc_m); ++*counter; - ossl_crypto_mutex_unlock(h->misc_m); ossl_crypto_condvar_broadcast(h->misc_cv); + ossl_crypto_mutex_unlock(h->misc_m); #endif return 1; } |