Skip to content

Commit

Permalink
KVM: MMU: bail out pagewalk on kvm_read_guest error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marcelo Tosatti committed Jan 25, 2010
1 parent d72118c commit a6085fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/x86/kvm/paging_tmpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
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))
Expand Down

0 comments on commit a6085fb

Please sign in to comment.