TF-M patch: Fix psa_set_rhandle() issue during CONNECT (TF-M issue #216)

- Link to bug tracking: https://developer.trustedfirmware.org/T216
pull/9653/head
Edison Ai 2019-02-11 17:17:34 +08:00 committed by Michael Schwarcz
parent 008bf1b2d1
commit 67a4e6d723
1 changed files with 14 additions and 3 deletions

View File

@ -435,9 +435,15 @@ static void tfm_svcall_psa_set_rhandle(uint32_t *args)
tfm_panic();
}
if (tfm_spm_set_rhandle(msg->service, msg->handle,
rhandle) != IPC_SUCCESS) {
tfm_panic();
/*
* Connection handle is not created while SP is processing PSA_IPC_CONNECT
* message. Store reverse handle temporarily and re-set it after the
* connection created.
*/
if (msg->handle != PSA_NULL_HANDLE) {
tfm_spm_set_rhandle(msg->service, msg->handle, rhandle);
} else {
msg->msg.rhandle = rhandle;
}
}
@ -744,6 +750,11 @@ static void tfm_svcall_psa_reply(uint32_t *args)
tfm_panic();
}
ret = connect_handle;
/* Set reverse handle after connection created if needed. */
if (msg->msg.rhandle) {
tfm_spm_set_rhandle(service, connect_handle, msg->msg.rhandle);
}
} else if (status == PSA_CONNECTION_REFUSED) {
ret = PSA_CONNECTION_REFUSED;
} else if (status == PSA_CONNECTION_BUSY) {