mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
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)
This commit is contained in:
parent
af5883fec9
commit
349d1cfddc
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user