Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1c47658 authored by Zhen Kong's avatar Zhen Kong Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarZhen Kong <zkong@codeaurora.org>
parent 25010e76
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2123,22 +2123,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);