diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2015-09-02 12:33:53 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-11-09 14:37:39 -0800 |
commit | 1ce8b6bd3f9f77c49908e9391ebc72114a65fc97 (patch) | |
tree | 7d730acc2306d51d334f664f1bc1594afbf83ad5 | |
parent | d61504b9fd2de498b0412abac8560c451a858f08 (diff) |
kvm: irqchip: fix memory leak
commit ba60c41ae392b473a1897faa0b8739fcb8759d69 upstream.
We were taking the exit path after checking ue->flags and return value
of setup_routing_entry(), but 'e' was not freed incase of a failure.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: William Dauchy <william@gandi.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | virt/kvm/irqchip.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c index 21c14244f4c4..d7ea8e20dae4 100644 --- a/virt/kvm/irqchip.c +++ b/virt/kvm/irqchip.c @@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm, goto out; r = -EINVAL; - if (ue->flags) + if (ue->flags) { + kfree(e); goto out; + } r = setup_routing_entry(new, e, ue); - if (r) + if (r) { + kfree(e); goto out; + } ++ue; } |