From 80671c0ae7f67e02ffc86da961db2af7c0c47e01 Mon Sep 17 00:00:00 2001 From: Avi Kivity <avi@redhat.com> Date: Mon, 3 May 2010 10:12:57 -0300 Subject: [PATCH] KVM: MMU: bail out pagewalk on kvm_read_guest error RH-Author: Avi Kivity <avi@redhat.com> Message-id: <1272881577-19754-1-git-send-email-avi@redhat.com> Patchwork-id: 8957 O-Subject: [PATCH RHEL5.5 RHEL5.4.z] KVM: MMU: bail out pagewalk on kvm_read_guest error Bugzilla: 588251 RH-Acked-by: Gleb Natapov <gleb@redhat.com> RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com> RH-Acked-by: Juan Quintela <quintela@redhat.com> From: Marcelo Tosatti <mtosatti@redhat.com> Bugzilla: 588251 Upstream: a6085fbaf65 Exit the guest pagetable walk loop if reading gpte failed. Otherwise its possible to enter an endless loop processing the previous present pte. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com> --- arch/x86/kvm/paging_tmpl.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- arch/x86/kvm/paging_tmpl.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index c1f05c2..3edb7c4 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -167,7 +167,8 @@ walk: pgprintk("%s: table_gfn[%d] %lx\n", __func__, walker->level - 1, table_gfn); - kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte)); + if (kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte))) + goto not_present; if (!is_present_pte(pte)) goto not_present; -- 1.7.0.3