diff options
author | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2018-01-05 11:30:36 +0000 |
---|---|---|
committer | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2018-01-10 15:39:37 +0000 |
commit | 96abc22b94b9871c77993be845e75af60f7ed3d9 (patch) | |
tree | 47224f1c65d836dafe0b1b9ea5cae30aad358227 | |
parent | 210d8d8b8a00b91399f2227840e15bfaafd024a2 (diff) |
xlat v2: Correctly unmap regions on map error
`mm_cursor` doesn't have the needed data because the `memmove()` that
is called right before it overwrites that information. In order to get
the information of the region that was being mapped, `mm` has to be used
instead (like it is done to fill the fields of `unmap_mm`).
If the incorrect information is read, this check isn't reliable and
`xlat_tables_unmap_region` may be requested to unmap memory that isn't
mapped at all, triggering assertions.
Change-Id: I602d4ac83095d4e5dac9deb34aa5d00d00e6c289
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
-rw-r--r-- | lib/xlat_tables_v2/xlat_tables_internal.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/xlat_tables_v2/xlat_tables_internal.c b/lib/xlat_tables_v2/xlat_tables_internal.c index 0acfacbf..75c5a912 100644 --- a/lib/xlat_tables_v2/xlat_tables_internal.c +++ b/lib/xlat_tables_v2/xlat_tables_internal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -893,7 +893,7 @@ int mmap_add_dynamic_region_ctx(xlat_ctx_t *ctx, mmap_region_t *mm) * Check if the mapping function actually managed to map * anything. If not, just return now. */ - if (mm_cursor->base_va >= end_va) + if (mm->base_va >= end_va) return -ENOMEM; /* |