From f54c22b8599b46a5a9b7b0024eb29c209b8fd426 Mon Sep 17 00:00:00 2001 From: "sean.huang" Date: Fri, 2 Jun 2017 09:46:14 +0800 Subject: [PATCH] optee: fix mutex_unlock after mutex_lock Change-Id: Ic5a4b5b4691b11083e5fd9e327fc4be82d626bfb Signed-off-by: sean.huang --- security/optee_linuxdriver/armtz/tee_tz_drv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/security/optee_linuxdriver/armtz/tee_tz_drv.c b/security/optee_linuxdriver/armtz/tee_tz_drv.c index 4b5ec5a4eeed..58b33f42f11b 100644 --- a/security/optee_linuxdriver/armtz/tee_tz_drv.c +++ b/security/optee_linuxdriver/armtz/tee_tz_drv.c @@ -1100,8 +1100,10 @@ out: param.a1 = TEESMC_ST_L2CC_MUTEX_DISABLE; #ifdef SWITCH_CPU0_DEBUG ret = tee_smc_call_switchcpu0(¶m); - if (ret) - goto out; + if (ret) { + mutex_unlock(&ptee->mutex); + return ret; + } #else tee_smc_call(¶m); #endif @@ -1132,8 +1134,10 @@ static int configure_shm(struct tee_tz *ptee) param.a0 = TEESMC32_ST_FASTCALL_GET_SHM_CONFIG; #ifdef SWITCH_CPU0_DEBUG ret = tee_smc_call_switchcpu0(¶m); - if (ret) + if (ret) { + mutex_unlock(&ptee->mutex); goto out; + } #else tee_smc_call(¶m); #endif -- 2.34.1