2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

fix lock order reversal

This commit is contained in:
Mark Andrews
2018-08-02 15:34:31 +10:00
parent bf98eb41bf
commit 2bb4392bb3

View File

@@ -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);