Skip to content

Commit

Permalink
core: prevent crash in tee_mmu_final() on TA loading error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
etienne-lms authored and jforissier committed Jan 22, 2018
1 parent b9a1067 commit e9596d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/arch/arm/mm/tee_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit e9596d0

Please sign in to comment.