KVM: fix lock imbalance in kvm_create_pit()
authorJiri Slaby <jirislaby@gmail.com>
Wed, 7 Jul 2010 13:02:25 +0000 (15:02 +0200)
committerAvi Kivity <avi@redhat.com>
Mon, 2 Aug 2010 03:40:31 +0000 (06:40 +0300)
Stanse found that there is an omitted unlock in kvm_create_pit in one fail
path. Add proper unlock there.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Gleb Natapov <gleb@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gregory Haskins <ghaskins@novell.com>
Cc: kvm@vger.kernel.org
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/i8254.c

index 467cc47..70db4d4 100644 (file)
@@ -696,6 +696,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags)
 
        pit->wq = create_singlethread_workqueue("kvm-pit-wq");
        if (!pit->wq) {
+               mutex_unlock(&pit->pit_state.lock);
                kfree(pit);
                return NULL;
        }