Skip to content

Commit c435d4b

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86/mmu: Properly dereference rcu-protected TDP MMU sptep iterator
Wrap the read of iter->sptep in tdp_mmu_map_handle_target_level() with rcu_dereference(). Shadow pages in the TDP MMU, and thus their SPTEs, are protected by rcu. This fixes a Sparse warning at tdp_mmu.c:900:51: warning: incorrect type in argument 1 (different address spaces) expected unsigned long long [usertype] *sptep got unsigned long long [noderef] [usertype] __rcu *[usertype] sptep Fixes: 7158bee ("KVM: MMU: pass kvm_mmu_page struct to make_spte") Cc: Ben Gardon <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent cae72dc commit c435d4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/mmu/tdp_mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu,
897897
struct kvm_page_fault *fault,
898898
struct tdp_iter *iter)
899899
{
900-
struct kvm_mmu_page *sp = sptep_to_sp(iter->sptep);
900+
struct kvm_mmu_page *sp = sptep_to_sp(rcu_dereference(iter->sptep));
901901
u64 new_spte;
902902
int ret = RET_PF_FIXED;
903903
bool wrprot = false;

0 commit comments

Comments
 (0)