mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Fix mutex unlock error handling in psa_destroy_key
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
@ -1167,17 +1167,19 @@ exit:
|
||||
/* Unregister from reading the slot. If we are the last active reader
|
||||
* then this will wipe the slot. */
|
||||
status = psa_unregister_read(slot);
|
||||
/* Prioritize CORRUPTION_DETECTED from unregistering over
|
||||
* a storage error. */
|
||||
if (status != PSA_SUCCESS) {
|
||||
overall_status = status;
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_THREADING_C)
|
||||
/* Don't overwrite existing errors if the unlock fails. */
|
||||
status = overall_status;
|
||||
PSA_THREADING_CHK_RET(mbedtls_mutex_unlock(
|
||||
&mbedtls_threading_key_slot_mutex));
|
||||
#endif
|
||||
|
||||
/* Prioritize CORRUPTION_DETECTED from unregistering or
|
||||
* SERVICE_FAILURE from unlocking over a storage error. */
|
||||
if (status != PSA_SUCCESS) {
|
||||
overall_status = status;
|
||||
}
|
||||
return overall_status;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user