From 6e8704fc7ac90fd3d4367fdb74e2bfce48a1c6f0 Mon Sep 17 00:00:00 2001 From: Sebastian Ene Date: Fri, 21 Apr 2023 14:39:49 +0000 Subject: [PATCH] ANDROID: KVM: arm64: Clear the PTEs which are not refcounted on unmap path With coalescing we don't refcount default PTE entries. Fix an issue which clears out non-refcounted PTE entries on the unmap path. Bug: 279165129 Change-Id: Ie4fdabcc420d54c1338272d38abbe393fc5ce75c Signed-off-by: Sebastian Ene --- arch/arm64/kvm/hyp/pgtable.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index 0add34ea9ff2..a5044b629cea 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -993,6 +993,8 @@ static int stage2_unmap_walker(u64 addr, u64 end, u32 level, kvm_pte_t *ptep, */ if (pte_ops->pte_is_counted_cb(pte, level)) stage2_put_pte(ptep, mmu, addr, level, mm_ops); + else + stage2_clear_pte(ptep, mmu, addr, level); if (need_flush && mm_ops->dcache_clean_inval_poc) mm_ops->dcache_clean_inval_poc(kvm_pte_follow(pte, mm_ops),