summaryrefslogtreecommitdiffstats
path: root/crypto/threads_win.c
diff options
context:
space:
mode:
authorDK <dmitrykos@neutroncode.com>2016-11-13 14:48:15 +0200
committerRich Salz <rsalz@openssl.org>2016-11-13 15:43:54 -0500
commitedc18749bd5dfb7e12513d3978f78f9b56104fd6 (patch)
tree6f1aa7e5c155f6ef65e41843ced450264eb67a12 /crypto/threads_win.c
parente2cefab06a9e1b8d9a21d030754f62dfbb199950 (diff)
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@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1913) (cherry picked from commit 349d1cfddcfa33d352240582a3803f2eba39d9a0)
Diffstat (limited to 'crypto/threads_win.c')
-rw-r--r--crypto/threads_win.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/threads_win.c b/crypto/threads_win.c
index 4e0de908ee..5347c9e46b 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);