Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1217359 > unrolled thread
| Started by | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| First post | 2015-09-02 09:10 +0200 |
| Last post | 2015-09-07 22:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] kvm: irqchip: fix memory leak Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-02 09:10 +0200
Re: [PATCH] kvm: irqchip: fix memory leak Paolo Bonzini <pbonzini@redhat.com> - 2015-09-07 22:10 +0200
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Date | 2015-09-02 09:10 +0200 |
| Subject | [PATCH] kvm: irqchip: fix memory leak |
| Message-ID | <q4alc-6kn-5@gated-at.bofh.it> |
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>
---
virt/kvm/irqchip.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index 21c1424..c63e54f 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;
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Date | 2015-09-07 22:10 +0200 |
| Message-ID | <q6aTM-7n0-39@gated-at.bofh.it> |
| In reply to | #1217359 |
On 02/09/2015 09:03, Sudip Mukherjee wrote:
> 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>
> ---
> virt/kvm/irqchip.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
> index 21c1424..c63e54f 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;
> }
>
>
Queued, thanks.
Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web