diff options
author | Richard Levitte <levitte@openssl.org> | 2016-11-14 23:53:45 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-11-15 01:27:26 +0100 |
commit | b7a7f39afeb4748b4c25dbccb8951711b8b70eaf (patch) | |
tree | be2d71166b077f37f4f001cead8ec66fd92242eb /crypto/init.c | |
parent | Configurations/10-main.conf: remove obsolete flag from solaris-x86-gcc. (diff) | |
download | openssl-b7a7f39afeb4748b4c25dbccb8951711b8b70eaf.tar.xz openssl-b7a7f39afeb4748b4c25dbccb8951711b8b70eaf.zip |
Stop init loops
Under certain circumstances, the libcrypto init code would loop,
causing a deadlock. This would typically happen if something in
ossl_init_base() caused an OpenSSL error, and the error stack routines
would recurse into the init code before the flag that ossl_init_base()
had been run was checked.
This change makes sure ossl_init_base isn't run once more of the base
is initiated.
Thanks to Dmitry Kostjuchenko for the idea.
Fixes Github issue #1899
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1922)
Diffstat (limited to '')
-rw-r--r-- | crypto/init.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/init.c b/crypto/init.c index e457b2dd0e..01619bc129 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -503,7 +503,7 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) return 0; } - if (!RUN_ONCE(&base, ossl_init_base)) + if (!base_inited && !RUN_ONCE(&base, ossl_init_base)) return 0; if ((opts & OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS) |