KVM: MMU: fix release noslot pfn
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Tue, 16 Oct 2012 12:07:03 +0000 (20:07 +0800)
committerAvi Kivity <avi@redhat.com>
Mon, 22 Oct 2012 16:03:25 +0000 (18:03 +0200)
We can not directly call kvm_release_pfn_clean to release the pfn
since we can meet noslot pfn which is used to cache mmio info into
spte

Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/mmu.c
virt/kvm/kvm_main.c

index d289fee1ffb8631c0b93f663104965fe7def7b11..6f85fe0bf958987f0275f1fa25e2b9e5240aad02 100644 (file)
@@ -2497,8 +2497,7 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
                }
        }
 
-       if (!is_error_pfn(pfn))
-               kvm_release_pfn_clean(pfn);
+       kvm_release_pfn_clean(pfn);
 }
 
 static void nonpaging_new_cr3(struct kvm_vcpu *vcpu)
index c353b4599cecdb4db0d3b276e1c12b81974cd2e7..a65bc02a3755e4e1eb6457d351994efe9d8ad7ed 100644 (file)
@@ -1322,9 +1322,7 @@ EXPORT_SYMBOL_GPL(kvm_release_page_clean);
 
 void kvm_release_pfn_clean(pfn_t pfn)
 {
-       WARN_ON(is_error_pfn(pfn));
-
-       if (!kvm_is_mmio_pfn(pfn))
+       if (!is_error_pfn(pfn) && !kvm_is_mmio_pfn(pfn))
                put_page(pfn_to_page(pfn));
 }
 EXPORT_SYMBOL_GPL(kvm_release_pfn_clean);