Fix mutex unlock error handling in psa_destroy_key
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
parent
a76a0011ab
commit
7fee4f7318
1 changed files with 7 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue