Skip to content

Commit

Permalink
KVM: x86/mmu: Check every prev_roots in __kvm_mmu_free_obsolete_roots()
Browse files Browse the repository at this point in the history
When freeing obsolete previous roots, check prev_roots as intended, not
the current root.

Signed-off-by: Shaoqin Huang <[email protected]>
Fixes: 527d5cd ("KVM: x86/mmu: Zap only obsolete roots if a root shadow page is zapped")
Message-Id: <[email protected]>
Cc: [email protected]
Reviewed-by: Sean Christopherson <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
huangshaoqin authored and bonzini committed Jun 7, 2022
1 parent 3e68490 commit cf4a869
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kvm/mmu/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5179,7 +5179,7 @@ static void __kvm_mmu_free_obsolete_roots(struct kvm *kvm, struct kvm_mmu *mmu)
roots_to_free |= KVM_MMU_ROOT_CURRENT;

for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) {
if (is_obsolete_root(kvm, mmu->root.hpa))
if (is_obsolete_root(kvm, mmu->prev_roots[i].hpa))
roots_to_free |= KVM_MMU_ROOT_PREVIOUS(i);
}

Expand Down

0 comments on commit cf4a869

Please sign in to comment.