From 424fc73a46dfdd606c21d362f11b46a6602d11f6 Mon Sep 17 00:00:00 2001
From: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Date: Tue, 14 Nov 2017 10:52:20 +0000
Subject: [PATCH] SDEI: Fix security state check for explicit dispatch

Change-Id: Ic381ab5d03ec68c7f6e8d357ac2e2cbf0cc6b2e8
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
---
 services/std_svc/sdei/sdei_intr_mgmt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/services/std_svc/sdei/sdei_intr_mgmt.c b/services/std_svc/sdei/sdei_intr_mgmt.c
index 4551a8b1e..42bf46d0f 100644
--- a/services/std_svc/sdei/sdei_intr_mgmt.c
+++ b/services/std_svc/sdei/sdei_intr_mgmt.c
@@ -475,8 +475,10 @@ int sdei_dispatch_event(int ev_num, unsigned int preempted_sec_state)
 	sdei_cpu_state_t *state;
 
 	/* Validate preempted security state */
-	if ((preempted_sec_state != SECURE) || (preempted_sec_state != NON_SECURE))
+	if ((preempted_sec_state != SECURE) &&
+			(preempted_sec_state != NON_SECURE)) {
 		return -1;
+	}
 
 	/* Can't dispatch if events are masked on this PE */
 	state = sdei_get_this_pe_state();
-- 
GitLab