OSDN Git Service

KVM: x86/mmu: Fix RCU usage when atomically zapping SPTEs
authorBen Gardon <bgardon@google.com>
Mon, 15 Mar 2021 23:38:01 +0000 (16:38 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 16 Mar 2021 18:15:24 +0000 (14:15 -0400)
Fix a missing rcu_dereference in tdp_mmu_zap_spte_atomic.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Ben Gardon <bgardon@google.com>
Message-Id: <20210315233803.2706477-3-bgardon@google.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/tdp_mmu.c

index db2936c..946da74 100644 (file)
@@ -543,7 +543,7 @@ static inline bool tdp_mmu_zap_spte_atomic(struct kvm *kvm,
         * here since the SPTE is going from non-present
         * to non-present.
         */
-       WRITE_ONCE(*iter->sptep, 0);
+       WRITE_ONCE(*rcu_dereference(iter->sptep), 0);
 
        return true;
 }