[PATCH] kvm: don't treat NULL parent_pte as multimapped in mmu_parent_walk()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a kvm_mmu_page is not multimapped but parent_pte is NULL
don't treat it as multimapped and dereference it.

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
---
This wasn't tested and maybe I misunderstood so please review.

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 4c3e5b2..eb17287 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1031,10 +1031,12 @@ static void mmu_parent_walk(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
 	struct kvm_mmu_page *parent_sp;
 	int i;
 
-	if (!sp->multimapped && sp->parent_pte) {
-		parent_sp = page_header(__pa(sp->parent_pte));
-		fn(vcpu, parent_sp);
-		mmu_parent_walk(vcpu, parent_sp, fn);
+	if (!sp->multimapped) {
+		if (sp->parent_pte) {
+			parent_sp = page_header(__pa(sp->parent_pte));
+			fn(vcpu, parent_sp);
+			mmu_parent_walk(vcpu, parent_sp, fn);
+		}
 		return;
 	}
 	hlist_for_each_entry(pte_chain, node, &sp->parent_ptes, link)

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux