From: Marcelo Tosatti Date: Sun, 8 Jun 2008 04:48:53 +0000 (-0300) Subject: KVM: MMU: Fix rmap_write_protect() hugepage iteration bug X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6597ca09e6c0e5aec7ffd2b8ab48c671d3c28414;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git KVM: MMU: Fix rmap_write_protect() hugepage iteration bug rmap_next() does not work correctly after rmap_remove(), as it expects the rmap chains not to change during iteration. Fix (for now) by restarting iteration from the beginning. Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index ee3f53098f0c..9628091c574d 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -640,6 +640,7 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn) rmap_remove(kvm, spte); --kvm->stat.lpages; set_shadow_pte(spte, shadow_trap_nonpresent_pte); + spte = NULL; write_protected = 1; } spte = rmap_next(kvm, rmapp, spte);