All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: don't treat NULL parent_pte as multimapped in mmu_parent_walk()
@ 2010-01-07 15:56 Roel Kluin
  2010-01-07 16:05 ` Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2010-01-07 15:56 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, kvm, linux-kernel

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@gmail.com>
---
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)


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] kvm: don't treat NULL parent_pte as multimapped in mmu_parent_walk()
@ 2010-01-07 15:56 Roel Kluin
  0 siblings, 0 replies; 3+ messages in thread
From: Roel Kluin @ 2010-01-07 15:56 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

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@gmail.com>
---
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)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-07 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-07 15:56 [PATCH] kvm: don't treat NULL parent_pte as multimapped in mmu_parent_walk() Roel Kluin
2010-01-07 16:05 ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2010-01-07 15:56 Roel Kluin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.