From: Pauli Date: Mon, 12 Aug 2019 10:07:39 +0000 (+1000) Subject: Access data after obtaining the lock not before. X-Git-Tag: openssl-3.0.0-alpha1~1618 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=aee6e29f0e88df18ebc21dbcf9d4d5794d7511e0;p=oweals%2Fopenssl.git Access data after obtaining the lock not before. It isn't completely clear that this constitutes a race condition, but it will always be conservative to access the locked data after getting the lock. Reviewed-by: Richard Levitte Reviewed-by: Bernd Edlinger (Merged from https://github.com/openssl/openssl/pull/9579) --- diff --git a/crypto/ex_data.c b/crypto/ex_data.c index a49aa087c8..cd8e695855 100644 --- a/crypto/ex_data.c +++ b/crypto/ex_data.c @@ -49,8 +49,8 @@ static EX_CALLBACKS *get_and_lock(OPENSSL_CTX *ctx, int class_index) return NULL; } - ip = &global->ex_data[class_index]; CRYPTO_THREAD_write_lock(global->ex_data_lock); + ip = &global->ex_data[class_index]; return ip; }