lkml.org 
[lkml]   [2023]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH V3 03/14] kvm: x86/mmu: Check mmu->sync_page pointer in kvm_sync_page_check()
    Date
    From: Lai Jiangshan <jiangshan.ljs@antgroup.com>

    Check the pointer before calling it to catch any possible mistake.

    Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
    ---
    arch/x86/kvm/mmu/mmu.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
    index ee2837ea18d4..69ab0d1bb0ec 100644
    --- a/arch/x86/kvm/mmu/mmu.c
    +++ b/arch/x86/kvm/mmu/mmu.c
    @@ -1940,7 +1940,7 @@ static bool kvm_sync_page_check(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
    * differs then the memslot lookup (SMM vs. non-SMM) will be bogus, the
    * reserved bits checks will be wrong, etc...
    */
    - if (WARN_ON_ONCE(sp->role.direct ||
    + if (WARN_ON_ONCE(sp->role.direct || !vcpu->arch.mmu->sync_page ||
    (sp->role.word ^ root_role.word) & ~sync_role_ign.word))
    return false;

    --
    2.19.1.6.gb485710b
    \
     
     \ /
      Last update: 2023-03-27 00:25    [W:6.052 / U:26.264 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site