[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20151106191709.047551112@linuxfoundation.org>
Date:	Fri,  6 Nov 2015 11:19:44 -0800
From:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:	linux-kernel@...r.kernel.org
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	stable@...r.kernel.org, Sudip Mukherjee <sudip@...torindia.org>,
	Paolo Bonzini <pbonzini@...hat.com>,
	William Dauchy <william@...di.net>
Subject: [PATCH 4.2 097/110] kvm: irqchip: fix memory leak
4.2-stable review patch.  If anyone has any objections, please let me know.
------------------
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
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@...torindia.org>
Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
Cc: William Dauchy <william@...di.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
 virt/kvm/irqchip.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
--- 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;
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists
 
