* [PATCH] kvm: fix usage of uninit spinlock in avic_vm_destroy()
@ 2017-01-24 13:06 Dmitry Vyukov
2017-01-24 21:23 ` David Hildenbrand
2017-03-14 20:38 ` Radim Krčmář
0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Vyukov @ 2017-01-24 13:06 UTC (permalink / raw)
To: pbonzini, rkrcmar
Cc: Dmitry Vyukov, Joerg Roedel, David Hildenbrand, kvm, syzkaller
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: Dmitry Vyukov <dvyukov@google.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: kvm@vger.kernel.org
Cc: syzkaller@googlegroups.com
---
arch/x86/kvm/svm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 08a4d3ab3455..3aecaa13fd22 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1382,6 +1382,9 @@ static void avic_vm_destroy(struct kvm *kvm)
unsigned long flags;
struct kvm_arch *vm_data = &kvm->arch;
+ if (!avic)
+ return;
+
avic_free_vm_id(vm_data->avic_vm_id);
if (vm_data->avic_logical_id_table_page)
--
2.11.0.483.g087da7b7c-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm: fix usage of uninit spinlock in avic_vm_destroy()
2017-01-24 13:06 [PATCH] kvm: fix usage of uninit spinlock in avic_vm_destroy() Dmitry Vyukov
@ 2017-01-24 21:23 ` David Hildenbrand
2017-03-14 20:38 ` Radim Krčmář
1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2017-01-24 21:23 UTC (permalink / raw)
To: Dmitry Vyukov, pbonzini, rkrcmar; +Cc: Joerg Roedel, kvm, syzkaller
Am 24.01.2017 um 14:06 schrieb Dmitry Vyukov:
> 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: Dmitry Vyukov <dvyukov@google.com>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Radim Krčmář" <rkrcmar@redhat.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: kvm@vger.kernel.org
> Cc: syzkaller@googlegroups.com
> ---
> arch/x86/kvm/svm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 08a4d3ab3455..3aecaa13fd22 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -1382,6 +1382,9 @@ static void avic_vm_destroy(struct kvm *kvm)
> unsigned long flags;
> struct kvm_arch *vm_data = &kvm->arch;
>
> + if (!avic)
> + return;
> +
> avic_free_vm_id(vm_data->avic_vm_id);
>
> if (vm_data->avic_logical_id_table_page)
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
David
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm: fix usage of uninit spinlock in avic_vm_destroy()
2017-01-24 13:06 [PATCH] kvm: fix usage of uninit spinlock in avic_vm_destroy() Dmitry Vyukov
2017-01-24 21:23 ` David Hildenbrand
@ 2017-03-14 20:38 ` Radim Krčmář
1 sibling, 0 replies; 3+ messages in thread
From: Radim Krčmář @ 2017-03-14 20:38 UTC (permalink / raw)
To: Dmitry Vyukov; +Cc: pbonzini, Joerg Roedel, David Hildenbrand, kvm, syzkaller
2017-01-24 14:06+0100, Dmitry Vyukov:
> 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: Dmitry Vyukov <dvyukov@google.com>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Radim Krčmář" <rkrcmar@redhat.com>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: kvm@vger.kernel.org
> Cc: syzkaller@googlegroups.com
> ---
svm_vm_data_hash_lock is initialized unconditionally now, so I've queued
it for 4.12,
Thanks.
> arch/x86/kvm/svm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 08a4d3ab3455..3aecaa13fd22 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -1382,6 +1382,9 @@ static void avic_vm_destroy(struct kvm *kvm)
> unsigned long flags;
> struct kvm_arch *vm_data = &kvm->arch;
>
> + if (!avic)
> + return;
> +
> avic_free_vm_id(vm_data->avic_vm_id);
>
> if (vm_data->avic_logical_id_table_page)
> --
> 2.11.0.483.g087da7b7c-goog
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-14 20:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-24 13:06 [PATCH] kvm: fix usage of uninit spinlock in avic_vm_destroy() Dmitry Vyukov
2017-01-24 21:23 ` David Hildenbrand
2017-03-14 20:38 ` Radim Krčmář
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox