Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161664AbbKFTW4 (ORCPT ); Fri, 6 Nov 2015 14:22:56 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47352 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751821AbbKFTWc (ORCPT ); Fri, 6 Nov 2015 14:22:32 -0500 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudip Mukherjee , Paolo Bonzini , William Dauchy Subject: [PATCH 4.2 097/110] kvm: irqchip: fix memory leak Date: Fri, 6 Nov 2015 11:19:44 -0800 Message-Id: <20151106191709.047551112@linuxfoundation.org> X-Mailer: git-send-email 2.6.2 In-Reply-To: <20151106191703.247930828@linuxfoundation.org> References: <20151106191703.247930828@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1221 Lines: 47 4.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sudip Mukherjee 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 Signed-off-by: Paolo Bonzini Cc: William Dauchy Signed-off-by: Greg Kroah-Hartman --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/