aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorIzik Eidus <ieidus@redhat.com>2009-07-28 14:26:58 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:33:20 -0400
commit3b80fffe2b31fb716d3ebe729c54464ee7856723 (patch)
tree9607efd950f70c279dba1e78506bbe9e5bb369bc /arch
parent95fb4eb6981216c07ac01f598e61b273b6eff58c (diff)
KVM: MMU: make __kvm_mmu_free_some_pages handle empty list
First check if the list is empty before attempting to look at list entries. Cc: stable@kernel.org Signed-off-by: Izik Eidus <ieidus@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/mmu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1249c12e1d5c..28be35c6ff1d 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2705,7 +2705,8 @@ EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_page_virt);
2705 2705
2706void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) 2706void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu)
2707{ 2707{
2708 while (vcpu->kvm->arch.n_free_mmu_pages < KVM_REFILL_PAGES) { 2708 while (vcpu->kvm->arch.n_free_mmu_pages < KVM_REFILL_PAGES &&
2709 !list_empty(&vcpu->kvm->arch.active_mmu_pages)) {
2709 struct kvm_mmu_page *sp; 2710 struct kvm_mmu_page *sp;
2710 2711
2711 sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev, 2712 sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev,