kvm: don't treat NULL parent_pte as multimapped in mmu_parent_walk()
PATCH 1/1 kvm: don't treat NULL parent_pte as multimapped in mmu_parent_walk()
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 <[email protected]>
---
This wasn't tested and maybe I misunderstood so please review.
arch/x86/kvm/mmu.c +6 -4
@@ -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)
Quoted 20 lines · Roel Kluin
If a
kvm_mmu_pageis not multimapped butparent_pteis NULL don't treat it as multimapped and dereference it.Signed-off-by Roel Kluin<[email protected]>---
This wasn't tested and maybe I misunderstood so please review.arch/x86/kvm/mmu.c +0
-3@@ -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);
arch/x86/kvm/mmu.c static void mmu_parent_walk(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, · line 1042
Quoted 10 lines
arch/x86/kvm/mmu.c +6
-1-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)
If sp->parent_pte is NULL then the list walk terminates immediately.
Signature · 1 line
error compiling committee.c: too many arguments to function