[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171213015606.6568-4-alexander.levin@verizon.com>
Date: Wed, 13 Dec 2017 01:56:14 +0000
From: alexander.levin@...izon.com
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Cc: Dmitry Vyukov <dvyukov@...gle.com>, Joerg Roedel <joro@...tes.org>,
"Paolo Bonzini" <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
David Hildenbrand <david@...hat.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"syzkaller@...glegroups.com" <syzkaller@...glegroups.com>,
alexander.levin@...izon.com
Subject: [PATCH AUTOSEL for 4.9 004/100] kvm: fix usage of uninit spinlock in
avic_vm_destroy()
From: Dmitry Vyukov <dvyukov@...gle.com>
[ Upstream commit 3863dff0c3dd72984395c93b12383b393c5c3989 ]
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@...gle.com>
Cc: Joerg Roedel <joro@...tes.org>
Cc: Paolo Bonzini <pbonzini@...hat.com>
Cc: "Radim Krčmář" <rkrcmar@...hat.com>
Cc: David Hildenbrand <david@...hat.com>
Cc: kvm@...r.kernel.org
Cc: syzkaller@...glegroups.com
Reviewed-by: David Hildenbrand <david@...hat.com>
Signed-off-by: Radim Krčmář <rkrcmar@...hat.com>
Signed-off-by: Sasha Levin <alexander.levin@...izon.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 23f1a6bd7a0d..8148d8ca7930 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
Powered by blists - more mailing lists