From: Hugo Landau Date: Thu, 31 Aug 2023 17:54:16 +0000 (+0100) Subject: MUTEX: Assert on locking failure X-Git-Tag: openssl-3.2.0-alpha1~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=17a0e930d2607e1d571c82912d5e1fa3393b2053;p=thirdparty%2Fopenssl.git MUTEX: Assert on locking failure Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/21919) --- diff --git a/crypto/thread/arch/thread_posix.c b/crypto/thread/arch/thread_posix.c index 0ab27b12302..f88323820f4 100644 --- a/crypto/thread/arch/thread_posix.c +++ b/crypto/thread/arch/thread_posix.c @@ -120,18 +120,22 @@ int ossl_crypto_mutex_try_lock(CRYPTO_MUTEX *mutex) void ossl_crypto_mutex_lock(CRYPTO_MUTEX *mutex) { + int rc; pthread_mutex_t *mutex_p; mutex_p = (pthread_mutex_t *)mutex; - pthread_mutex_lock(mutex_p); + rc = pthread_mutex_lock(mutex_p); + OPENSSL_assert(rc == 0); } void ossl_crypto_mutex_unlock(CRYPTO_MUTEX *mutex) { + int rc; pthread_mutex_t *mutex_p; mutex_p = (pthread_mutex_t *)mutex; - pthread_mutex_unlock(mutex_p); + rc = pthread_mutex_unlock(mutex_p); + OPENSSL_assert(rc == 0); } void ossl_crypto_mutex_free(CRYPTO_MUTEX **mutex)