Commit 3863dff0 authored by Dmitry Vyukov's avatar Dmitry Vyukov Committed by Radim Krčmář
Browse files

kvm: fix usage of uninit spinlock in avic_vm_destroy()

If avic is not enabled, avic_vm_init() does nothing and returns early.
However, avic_vm_destroy() still tries to destroy what hasn't been created.
The only bad consequence of this now is that avic_vm_destroy() uses
svm_vm_data_hash_lock that hasn't been initialized (and is not meant
to be used at all if avic is not enabled).

Return early from avic_vm_destroy() if avic is not enabled.
It has nothing to destroy.

Signed-off-by: default avatarDmitry Vyukov <>
Cc: Joerg Roedel <>
Cc: Paolo Bonzini <>
Cc: "Radim Krčmář" <>
Cc: David Hildenbrand <>
Reviewed-by: default avatarDavid Hildenbrand <>
Signed-off-by: default avatarRadim Krčmář <>
parent 6c6c5e03
......@@ -1379,6 +1379,9 @@ static void avic_vm_destroy(struct kvm *kvm)
unsigned long flags;
struct kvm_arch *vm_data = &kvm->arch;
if (!avic)
if (vm_data->avic_logical_id_table_page)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment