summaryrefslogtreecommitdiffstats
path: root/crypto/property
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2020-11-04 20:55:36 +0100
committerBernd Edlinger <bernd.edlinger@hotmail.de>2020-11-08 07:44:28 +0100
commit07af94416ff740b4346689ee4c20cb26a33708c7 (patch)
tree972fbf7fc6f21f83a3130509e0980dd28292ec2f /crypto/property
parente6774a7289707061fb19bf5f32996147dcc9a860 (diff)
This should fix a lock-order-inversion
Calling OPENSSL_init_crypto before acquiring the ossl_property_read_lock in ossl_method_store_fetch makes the second call to OPENSSL_init_crypto from ossl_ctx_global_properties unnecessary. Fixes #12869 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/13321)
Diffstat (limited to 'crypto/property')
-rw-r--r--crypto/property/property.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/property/property.c b/crypto/property/property.c
index 9cfca81190..985709b204 100644
--- a/crypto/property/property.c
+++ b/crypto/property/property.c
@@ -338,7 +338,8 @@ int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid,
int j, best = -1, score, optional;
#ifndef FIPS_MODULE
- OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);
+ if (!OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
+ return 0;
#endif
if (nid <= 0 || method == NULL || store == NULL)
@@ -357,7 +358,7 @@ int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid,
if (prop_query != NULL)
p2 = pq = ossl_parse_query(store->ctx, prop_query);
- plp = ossl_ctx_global_properties(store->ctx, 1);
+ plp = ossl_ctx_global_properties(store->ctx, 0);
if (plp != NULL && *plp != NULL) {
if (pq == NULL) {
pq = *plp;