Skip to content

Commit

Permalink
KVM: MMU: Fix rmap_write_protect() hugepage iteration bug
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
matosatti authored and avikivity committed Jun 24, 2008
1 parent 06e0564 commit 6597ca0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions arch/x86/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6597ca0

Please sign in to comment.