KVM: MMU: bail out pagewalk on kvm_read_guest error
authorMarcelo Tosatti <mtosatti@redhat.com>
Thu, 14 Jan 2010 19:41:27 +0000 (17:41 -0200)
committerMarcelo Tosatti <mtosatti@redhat.com>
Mon, 25 Jan 2010 14:26:38 +0000 (12:26 -0200)
Exit the guest pagetable walk loop if reading gpte failed. Otherwise its
possible to enter an endless loop processing the previous present pte.

Cc: stable@kernel.org
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/paging_tmpl.h

index 58a0f1e8859655154da07037604ebd5fb1872c7f..ede2131a9225eb00530aafb62962e383ab2a7101 100644 (file)
@@ -150,7 +150,9 @@ walk:
                walker->table_gfn[walker->level - 1] = table_gfn;
                walker->pte_gpa[walker->level - 1] = pte_gpa;
 
-               kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte));
+               if (kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte)))
+                       goto not_present;
+
                trace_kvm_mmu_paging_element(pte, walker->level);
 
                if (!is_present_gpte(pte))