]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Access data after obtaining the lock not before.
authorPauli <paul.dale@oracle.com>
Mon, 12 Aug 2019 10:07:39 +0000 (20:07 +1000)
committerPauli <paul.dale@oracle.com>
Mon, 12 Aug 2019 11:37:55 +0000 (21:37 +1000)
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 <levitte@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/9579)

crypto/ex_data.c

index a49aa087c88c42442e669fc0e177febd70af2fb4..cd8e695855f5bc7d41a67963a52449398de6f1ce 100644 (file)
@@ -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;
 }