qseecom: add additonal reentrancy check before scm call
scm call of send data will fail with EBUSY if there are more than one TAs requesting listener services, add additional checks before scm call and wait until no more than one listener request in the system. Change-Id: Ic891e687062dc52f02639605f3bac0e1c4540a6f Signed-off-by: Zhen Kong <zkong@codeaurora.org>
This commit is contained in:
parent
42e1251b38
commit
3f13257ff6
1 changed files with 6 additions and 4 deletions
|
@ -2135,22 +2135,24 @@ static void __qseecom_reentrancy_check_if_no_app_blocked(uint32_t smc_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* scm_call send command to a blocked TZ app will fail
|
* scm_call of send data will fail if this TA is blocked or there are more
|
||||||
* So, first check and then wait until this apps is unblocked
|
* than one TA requesting listener services; So, first check to see if need
|
||||||
|
* to wait.
|
||||||
*/
|
*/
|
||||||
static void __qseecom_reentrancy_check_if_this_app_blocked(
|
static void __qseecom_reentrancy_check_if_this_app_blocked(
|
||||||
struct qseecom_registered_app_list *ptr_app)
|
struct qseecom_registered_app_list *ptr_app)
|
||||||
{
|
{
|
||||||
sigset_t new_sigset, old_sigset;
|
sigset_t new_sigset, old_sigset;
|
||||||
if (qseecom.qsee_reentrancy_support) {
|
if (qseecom.qsee_reentrancy_support) {
|
||||||
while (ptr_app->app_blocked) {
|
while (ptr_app->app_blocked || qseecom.app_block_ref_cnt > 1) {
|
||||||
/* thread sleep until this app unblocked */
|
/* thread sleep until this app unblocked */
|
||||||
sigfillset(&new_sigset);
|
sigfillset(&new_sigset);
|
||||||
sigprocmask(SIG_SETMASK, &new_sigset, &old_sigset);
|
sigprocmask(SIG_SETMASK, &new_sigset, &old_sigset);
|
||||||
mutex_unlock(&app_access_lock);
|
mutex_unlock(&app_access_lock);
|
||||||
do {
|
do {
|
||||||
if (!wait_event_freezable(qseecom.app_block_wq,
|
if (!wait_event_freezable(qseecom.app_block_wq,
|
||||||
!ptr_app->app_blocked))
|
(!ptr_app->app_blocked &&
|
||||||
|
qseecom.app_block_ref_cnt <= 1)))
|
||||||
break;
|
break;
|
||||||
} while (1);
|
} while (1);
|
||||||
mutex_lock(&app_access_lock);
|
mutex_lock(&app_access_lock);
|
||||||
|
|
Loading…
Add table
Reference in a new issue