mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 09:59:32 +00:00
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>
This commit is contained in:
parent
c60ff51eb2
commit
e17d1dc086
1 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue