summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2021-12-06 22:54:31 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2021-12-08 12:24:35 +0300
commitbcb63dcde829945487bad4917b614c28aaa59141 (patch)
treefe79d088f4cb1e187ec06af0fb9b685bf41f14cb /virt
parenta54d806688fe1e482350ce759a8a0fc9ebf814b0 (diff)
downloadlinux-bcb63dcde829945487bad4917b614c28aaa59141.tar.xz
KVM: Call kvm_arch_flush_shadow_memslot() on the old slot in kvm_invalidate_memslot()
kvm_invalidate_memslot() calls kvm_arch_flush_shadow_memslot() on the active, but KVM_MEMSLOT_INVALID slot. Do it on the inactive (but valid) old slot instead since arch code really should not get passed such invalid slot. Note that this means that the "arch" field of the slot provided to kvm_arch_flush_shadow_memslot() may have stale data since this function is called with slots_arch_lock released. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Reviewed-by: Sean Christopherson <seanjc@google.com> Message-Id: <813595ecc193d6ae39a87709899d4251523b05f8.1638817641.git.maciej.szmigiero@oracle.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a87df97e0b14..130eaf1c5711 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1630,7 +1630,7 @@ static void kvm_invalidate_memslot(struct kvm *kvm,
* - gfn_to_hva (kvm_read_guest, gfn_to_pfn)
* - kvm_is_visible_gfn (mmu_check_root)
*/
- kvm_arch_flush_shadow_memslot(kvm, working_slot);
+ kvm_arch_flush_shadow_memslot(kvm, old);
/* Was released by kvm_swap_active_memslots, reacquire. */
mutex_lock(&kvm->slots_arch_lock);