Skip to content

Commit 34b8f4a

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Mark freed S2 MMUs as invalid
When freeing an S2 MMU, we free the associated pgd, but omit to mark the structure as invalid. Subsequently, a call to kvm_nested_s2_unmap() would pick these invalid S2 MMUs and pass them down the teardown path. This ends up with a nasty warning as we try to unmap an unallocated set of page tables. Fix this by making the S2 MMU invalid on freeing the pgd by calling kvm_init_nested_s2_mmu(). Fixes: 4f128f8 ("KVM: arm64: nv: Support multiple nested Stage-2 mmu structures") Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent b320789 commit 34b8f4a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm64/kvm/mmu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,10 @@ void kvm_free_stage2_pgd(struct kvm_s2_mmu *mmu)
11061106
mmu->pgt = NULL;
11071107
free_percpu(mmu->last_vcpu_ran);
11081108
}
1109+
1110+
if (kvm_is_nested_s2_mmu(kvm, mmu))
1111+
kvm_init_nested_s2_mmu(mmu);
1112+
11091113
write_unlock(&kvm->mmu_lock);
11101114

11111115
if (pgt) {

0 commit comments

Comments
 (0)