From: Matt Caswell Date: Mon, 14 Nov 2016 11:55:13 +0000 (+0000) Subject: Revert "Fixed deadlock in CRYPTO_THREAD_run_once for Windows" X-Git-Tag: OpenSSL_1_1_1-pre1~3076 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1fda5bc435ada1c70f2d3342bb9db98ac5840dc9;p=oweals%2Fopenssl.git Revert "Fixed deadlock in CRYPTO_THREAD_run_once for Windows" This reverts commit 349d1cfddcfa33d352240582a3803f2eba39d9a0. The proposed fix is incorrect. It marks the "run_once" code as having finished before it has. The intended semantics of run_once is that no threads should proceed until the code has run exactly once. With this change the "second" thread will think the run_once code has already been run and will continue, even though it is still in progress. This could result in a crash or other incorrect behaviour. Reviewed-by: Tim Hudson --- diff --git a/crypto/threads_win.c b/crypto/threads_win.c index 5347c9e46b..4e0de908ee 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) { - *lock = ONCE_DONE; init(); + *lock = ONCE_DONE; return 1; } } while (result == ONCE_ININIT);