From 2bb4392bb3de0b10f9e31f14e4f871f6863cfc2e Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 2 Aug 2018 15:34:31 +1000 Subject: [PATCH 1/2] fix lock order reversal --- lib/isc/pk11.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/isc/pk11.c b/lib/isc/pk11.c index 57bf2a234e..cfc5e52074 100644 --- a/lib/isc/pk11.c +++ b/lib/isc/pk11.c @@ -182,21 +182,20 @@ pk11_mem_put(void *ptr, size_t size) { isc_result_t pk11_initialize(isc_mem_t *mctx, const char *engine) { - isc_result_t result; + isc_result_t result = ISC_R_SUCCESS; CK_RV rv; RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS); + LOCK(&sessionlock); LOCK(&alloclock); if ((mctx != NULL) && (pk11_mctx == NULL) && (allocsize == 0)) isc_mem_attach(mctx, &pk11_mctx); + UNLOCK(&alloclock); if (initialized) { - UNLOCK(&alloclock); - return (ISC_R_SUCCESS); + goto unlock; } else { - LOCK(&sessionlock); initialized = true; - UNLOCK(&alloclock); } ISC_LIST_INIT(tokens); @@ -220,7 +219,6 @@ pk11_initialize(isc_mem_t *mctx, const char *engine) { } scan_slots(); - result = ISC_R_SUCCESS; unlock: UNLOCK(&sessionlock); return (result); From 083007e930e6dbd225e26584e1b256dc1b1dd1e6 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 21 Aug 2018 12:18:27 +1000 Subject: [PATCH 2/2] add CHANGES note --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index eb27b9a471..8d6c1c2a65 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +5012. [bug] Fix lock order reversal in pk11_initialize. [GL !590] + 5011. [func] Remove support for unthreaded named. [GL #478] 5010. [func] New "validate-except" option specifies a list of