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

Commit aae9b8af authored by Andrey Markovytch's avatar Andrey Markovytch Committed by Gerrit - the friendly Code Review server
Browse files

qseecom: added small sleep between busy-wait calls to TZ



In case of time penalty coming from TZ side when the wrong password
is entered too many times, there should be sleep between the scm calls
to give other HLOS tasks opportunity to run. Otherwise starvation may
occur

Change-Id: I345a9b6c82fb5e591d8bdcf48afed48ccaafddc3
Signed-off-by: default avatarAndrey Markovytch <andreym@codeaurora.org>
parent 0c3a23a4
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@
#include "qseecom_legacy.h"
#include "qseecom_kernel.h"
#include <crypto/ice.h>
#include <linux/delay.h>

#include <linux/compat.h>
#include "compat_qseecom.h"
@@ -5294,6 +5295,11 @@ static int qseecom_create_key(struct qseecom_dev_handle *data,
			ret = __qseecom_set_clear_ce_key(data,
					create_key_req.usage,
					&set_key_ireq);
			/* wait a little before calling scm again to let other
			   processes run */
			if (ret == QSEOS_RESULT_FAIL_PENDING_OPERATION)
				msleep(50);

		} while (ret == QSEOS_RESULT_FAIL_PENDING_OPERATION);

		qseecom_disable_ice_setup(create_key_req.usage);
@@ -5465,6 +5471,11 @@ static int qseecom_update_key_user_info(struct qseecom_dev_handle *data,
		ret = __qseecom_update_current_key_user_info(data,
						update_key_req.usage,
						&ireq);
		/* wait a little before calling scm again to let other
		   processes run */
		if (ret == QSEOS_RESULT_FAIL_PENDING_OPERATION)
			msleep(50);

	} while (ret == QSEOS_RESULT_FAIL_PENDING_OPERATION);
	if (ret) {
		pr_err("Failed to update key info: %d\n", ret);