Commit 1ce8b6bd authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Greg Kroah-Hartman

kvm: irqchip: fix memory leak

commit ba60c41a 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: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Cc: William Dauchy <william@gandi.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d61504b9
...@@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm, ...@@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm,
goto out; goto out;
r = -EINVAL; r = -EINVAL;
if (ue->flags) if (ue->flags) {
kfree(e);
goto out; goto out;
}
r = setup_routing_entry(new, e, ue); r = setup_routing_entry(new, e, ue);
if (r) if (r) {
kfree(e);
goto out; goto out;
}
++ue; ++ue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment