summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2008-11-11 12:09:36 +0100
committerAvi Kivity <avi@redhat.com>2008-11-11 20:01:51 +0100
commite17d1dc0863767bab8fde4ba9be92c7f79e7fe50 (patch)
tree79ae45dbe65c8e47b0eac7a21affb833bc6dc4f0 /arch
parentKVM: ia64: fix vmm_spin_{un}lock for !CONFIG_SMP (diff)
downloadlinux-e17d1dc0863767bab8fde4ba9be92c7f79e7fe50.tar.xz
linux-e17d1dc0863767bab8fde4ba9be92c7f79e7fe50.zip
KVM: Fix pit memory leak if unable to allocate irq source id
Reported-By: Daniel Marjamäki <danielm77@spray.se> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/i8254.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 8772dc946823..59ebd37ad79e 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -548,8 +548,10 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm)
mutex_lock(&kvm->lock);
pit->irq_source_id = kvm_request_irq_source_id(kvm);
mutex_unlock(&kvm->lock);
- if (pit->irq_source_id < 0)
+ if (pit->irq_source_id < 0) {
+ kfree(pit);
return NULL;
+ }
mutex_init(&pit->pit_state.lock);
mutex_lock(&pit->pit_state.lock);