[PATCH] armv8: mmu: don't panic when unmapping a page which isn't mapped
Casey Connolly
casey.connolly at linaro.org
Fri Jun 12 13:31:00 CEST 2026
If a caller tries to unmap a single page which is already part of an
unmapped block, set_one_region() will panic since there isn't a valid
block or table to contain the page. Detect this case explicitly and
return since no action needs to be taken.
Signed-off-by: Casey Connolly <casey.connolly at linaro.org>
---
Depends on my previous series which fixes unmapping regions
https://lore.kernel.org/u-boot/20260608-b4-mmu-unmap-fixes-v6-0-ac0764cccf40@linaro.org/
---
arch/arm/cpu/armv8/cache_v8.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
index 6c85022556ad..472887b5d99b 100644
--- a/arch/arm/cpu/armv8/cache_v8.c
+++ b/arch/arm/cpu/armv8/cache_v8.c
@@ -1003,8 +1003,13 @@ static u64 set_one_region(u64 start, u64 size, u64 attrs, bool flag, int level)
int levelshift = level2shift(level);
u64 levelsize = 1ULL << levelshift;
u64 *pte = find_pte(start, level);
+ /* Trying to unmap a region which is part of an already unmapped block, nothing to do */
+ if (pte_type(pte) == PTE_TYPE_FAULT && attrs == PTE_TYPE_FAULT && size < levelsize) {
+ return size;
+ }
+
/* Can we can just modify the current level block/page? */
if (is_aligned(start, size, levelsize)) {
if (attrs == PTE_TYPE_FAULT) {
if (pte_type(pte) == PTE_TYPE_TABLE && level < 3)
--
2.53.0
More information about the U-Boot
mailing list