From 78f9f87a9d659aa823aebd28e1a0014dbf80e800 Mon Sep 17 00:00:00 2001 From: Elon Zhang Date: Tue, 14 May 2019 17:33:58 +0800 Subject: [PATCH] OP-TEE: optimize client application running process Client applications are forbidden to run before supplicant application is ready. Detection of supplicant application status is added at the entry of open operation. Change-Id: Ief4106bcd75251790b82d76e4d69092900af29e3 Signed-off-by: Elon Zhang --- security/optee_linuxdriver/core/tee_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/security/optee_linuxdriver/core/tee_core.c b/security/optee_linuxdriver/core/tee_core.c index c718481982fb..ef949c583e32 100644 --- a/security/optee_linuxdriver/core/tee_core.c +++ b/security/optee_linuxdriver/core/tee_core.c @@ -174,6 +174,12 @@ static int tee_supp_open(struct tee *tee) __func__); atomic_sub(1, &tee->rpc->used); } + } else { + if (atomic_read(&tee->rpc->used) == 0) { + ret = -EPERM; + dev_err(tee->dev, "%s: ERROR Supplicant application NOT ready\n", + __func__); + } } return ret;