[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Sun Nov 13 20:43:40 UTC 2016


The branch master has been updated
       via  349d1cfddcfa33d352240582a3803f2eba39d9a0 (commit)
      from  af5883fec95eb8c79c379b09885440a0d88b2d38 (commit)


- Log -----------------------------------------------------------------
commit 349d1cfddcfa33d352240582a3803f2eba39d9a0
Author: DK <dmitrykos at neutroncode.com>
Date:   Sun Nov 13 14:48:15 2016 +0200

    Fixed deadlock in CRYPTO_THREAD_run_once for Windows
    
    Fixed deadlock in CRYPTO_THREAD_run_once() if call to init() is causing
    a recursive call to CRYPTO_THREAD_run_once() again that is causing a hot
    deadloop inside do { } while (result == ONCE_ININIT); section.
    
    CLA: trivial
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/1913)

-----------------------------------------------------------------------

Summary of changes:
 crypto/threads_win.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/threads_win.c b/crypto/threads_win.c
index 4e0de90..5347c9e 100644
--- a/crypto/threads_win.c
+++ b/crypto/threads_win.c
@@ -78,8 +78,8 @@ int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
     do {
         result = InterlockedCompareExchange(lock, ONCE_ININIT, ONCE_UNINITED);
         if (result == ONCE_UNINITED) {
-            init();
             *lock = ONCE_DONE;
+            init();
             return 1;
         }
     } while (result == ONCE_ININIT);


More information about the openssl-commits mailing list