-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Closed
Description
Hi, developers, it seems the lock pk->lock (Line 171) is not released correctly when !evp_keymgmt_util_cache_keydata(pk, keymgmt, import_data.keydata). Should it be a bug, which potentially leads to recursively requiring the same lock?
openssl/crypto/evp/keymgmt_lib.c
Lines 171 to 207 in 2f61bc1
| if (!CRYPTO_THREAD_write_lock(pk->lock)) { | |
| evp_keymgmt_freedata(keymgmt, import_data.keydata); | |
| return NULL; | |
| } | |
| /* Check to make sure some other thread didn't get there first */ | |
| op = evp_keymgmt_util_find_operation_cache(pk, keymgmt); | |
| if (op != NULL && op->keydata != NULL) { | |
| void *ret = op->keydata; | |
| CRYPTO_THREAD_unlock(pk->lock); | |
| /* | |
| * Another thread seemms to have already exported this so we abandon | |
| * all the work we just did. | |
| */ | |
| evp_keymgmt_freedata(keymgmt, import_data.keydata); | |
| return ret; | |
| } | |
| /* | |
| * If the dirty counter changed since last time, then clear the | |
| * operation cache. In that case, we know that |i| is zero. | |
| */ | |
| if (pk->dirty_cnt != pk->dirty_cnt_copy) | |
| evp_keymgmt_util_clear_operation_cache(pk, 0); | |
| /* Add the new export to the operation cache */ | |
| if (!evp_keymgmt_util_cache_keydata(pk, keymgmt, import_data.keydata)) { | |
| evp_keymgmt_freedata(keymgmt, import_data.keydata); | |
| return NULL; | |
| } | |
| /* Synchronize the dirty count */ | |
| pk->dirty_cnt_copy = pk->dirty_cnt; | |
| CRYPTO_THREAD_unlock(pk->lock); |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels