diff options
author | Avi Kivity <avi@redhat.com> | 2009-01-05 08:21:42 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-03-24 05:03:01 -0400 |
commit | 269e05e48502f1cc06802e9fba90f5100dd6bb0d (patch) | |
tree | 9b3501dc1f5e137c2dca7eacf15c0353f627be97 /arch/x86/kvm/i8254.c | |
parent | a77ab5ead5c1fef2c6c5a9b3cf3765e52643a2aa (diff) |
KVM: Properly lock PIT creation
Otherwise, two threads can create a PIT in parallel and cause a memory leak.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/i8254.c')
-rw-r--r-- | arch/x86/kvm/i8254.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 528daadeba49..69d1bbff3fd3 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -548,9 +548,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm) | |||
548 | if (!pit) | 548 | if (!pit) |
549 | return NULL; | 549 | return NULL; |
550 | 550 | ||
551 | mutex_lock(&kvm->lock); | ||
552 | pit->irq_source_id = kvm_request_irq_source_id(kvm); | 551 | pit->irq_source_id = kvm_request_irq_source_id(kvm); |
553 | mutex_unlock(&kvm->lock); | ||
554 | if (pit->irq_source_id < 0) { | 552 | if (pit->irq_source_id < 0) { |
555 | kfree(pit); | 553 | kfree(pit); |
556 | return NULL; | 554 | return NULL; |