diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c index 1653f7e1ae99..d3b41331faec 100644 --- a/drivers/misc/qseecom.c +++ b/drivers/misc/qseecom.c @@ -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 - * So, first check and then wait until this apps is unblocked + * scm_call of send data will fail if this TA is blocked or there are more + * than one TA requesting listener services; So, first check to see if need + * to wait. */ static void __qseecom_reentrancy_check_if_this_app_blocked( struct qseecom_registered_app_list *ptr_app) { sigset_t new_sigset, old_sigset; 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 */ sigfillset(&new_sigset); sigprocmask(SIG_SETMASK, &new_sigset, &old_sigset); mutex_unlock(&app_access_lock); do { if (!wait_event_freezable(qseecom.app_block_wq, - !ptr_app->app_blocked)) + (!ptr_app->app_blocked && + qseecom.app_block_ref_cnt <= 1))) break; } while (1); mutex_lock(&app_access_lock);