KVM: MMU: skip invalid sp when unprotect page
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Fri, 4 Jun 2010 13:52:17 +0000 (21:52 +0800)
committerAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 07:39:26 +0000 (10:39 +0300)
In kvm_mmu_unprotect_page(), the invalid sp can be skipped

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/mmu.c

index d3cd102aee262e5405c3a1ec3bd8b1b3f053eac5..3ac51153bc4721ef6521d5e4d75d27be57f71c95 100644 (file)
@@ -1629,7 +1629,7 @@ static int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn)
        bucket = &kvm->arch.mmu_page_hash[index];
 restart:
        hlist_for_each_entry_safe(sp, node, n, bucket, hash_link)
-               if (sp->gfn == gfn && !sp->role.direct) {
+               if (sp->gfn == gfn && !sp->role.direct && !sp->role.invalid) {
                        pgprintk("%s: gfn %lx role %x\n", __func__, gfn,
                                 sp->role.word);
                        r = 1;