aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Carriere <etienne.carriere@linaro.org>2018-01-22 16:08:23 +0100
committerJerome Forissier <jerome.forissier@linaro.org>2018-01-22 17:35:16 +0100
commite9596d07f18a3e82de1567d72ad210e21eca3ffa (patch)
tree6d71a1610e9d84100bcd7b0d7702673c8575b39e
parentb9a1067e88f3883f0fdd7efc4c68dc4b8f9c4857 (diff)
core: prevent crash in tee_mmu_final() on TA loading error3.0.0-rc2
If the creation of the TA execution context fails before the mapping directives are initialized, tee_mmu_final() will be called with the TA context field mmu being NULL. This change allows tee_mmu_final() to be called with uninitialized mapping resources without crashing the core. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
-rw-r--r--core/arch/arm/mm/tee_mmu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/arch/arm/mm/tee_mmu.c b/core/arch/arm/mm/tee_mmu.c
index af1c8670..dc666c67 100644
--- a/core/arch/arm/mm/tee_mmu.c
+++ b/core/arch/arm/mm/tee_mmu.c
@@ -676,6 +676,9 @@ void tee_mmu_rem_rwmem(struct user_ta_ctx *utc, struct mobj *mobj, vaddr_t va)
*/
void tee_mmu_final(struct user_ta_ctx *utc)
{
+ if (!utc->mmu)
+ return;
+
/* clear MMU entries to avoid clash when asid is reused */
tlbi_asid(utc->mmu->asid);