Received: by 10.192.165.156 with SMTP id m28csp1122388imm; Wed, 11 Apr 2018 12:52:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx49FSinJw97IVNFAGKdSf+va6rsllSMyuHBp1jU5XA51qcfW9uuAPYt2+R8RpQFlM7kgHp46 X-Received: by 10.101.90.13 with SMTP id y13mr2491478pgs.324.1523476335023; Wed, 11 Apr 2018 12:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523476334; cv=none; d=google.com; s=arc-20160816; b=UsIi8ug3heKy7LsNElimuP9mr0iXSObu42UatkkTywpzJdo0TivR9hLpnqP9/n8L4m 1QZ4/bAYdStOmuHVQjXcHL3UnITl9OhdKAX4F4qkpPwopWTLkphrsVPioSm9AUsalCdH nHjr7PDh7C7gLWw7cwK9/W1oL4SryZCZfXwhhgcyVVufYCx2o+qrExS0Mp3J9wLaxoHD cWhj99GtR1fnZx93UAwiNEXQV7uyaG5leqit7CJZr21VME/qLIaPRbBaVtgtaBkfZMVz W3sIHWkqsRS4FjrUKfMjyoMCC/dmRTdXcDtVBtuWtBQs5I1i063zgGUN1XOSqBt/uOGx o0Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=iFVG0ouWJ2+Vamv3mBDIVvG+PfKwWMGyu0ZyZdule4I=; b=TVRASMWUQNb4vTEo/nreE5LLtqdVeGv9TGvC8l4YUk3FbkwhLyEB8LXzOL7MztGPCx dXWSHglBP4gKI5gF/qxYW71yK5wZlZkVWCt9IMWkyaGAdJHjAf9QLTmDY3E3kQxfH7+s uEfnUCvhSxVK6mfTeXK8tLQTp2xIRI1M5zux/axQNj6SmqGJhusWaLL+HdBJGOi7uyqs BmKoyyE0OEOVzh/rmxcSPuAHOUyMXAbmXAPnXLLHaqkVl3FIKibta0+HqzwH4YFE6vFa slyzEGZDW/7zZV/SlS+eMbzKSyNOc/tLVxY6/3me6mgHnG/2GikzrkAx/Lw60SFuNqIg Crsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9-v6si1745913pln.439.2018.04.11.12.51.38; Wed, 11 Apr 2018 12:52:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934028AbeDKS7B (ORCPT + 99 others); Wed, 11 Apr 2018 14:59:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36866 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934013AbeDKS66 (ORCPT ); Wed, 11 Apr 2018 14:58:58 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4C5E7E0F; Wed, 11 Apr 2018 18:58:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomasz Nowicki , Timmy Li , Lorenzo Pieralisi , Will Deacon , Bjorn Helgaas , Catalin Marinas , Sasha Levin Subject: [PATCH 4.9 108/310] ARM64: PCI: Fix struct acpi_pci_root_ops allocation failure path Date: Wed, 11 Apr 2018 20:34:07 +0200 Message-Id: <20180411183626.848924609@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Timmy Li [ Upstream commit 717902cc93118119a6fce7765da6cf2786987418 ] Commit 093d24a20442 ("arm64: PCI: Manage controller-specific data on per-controller basis") added code to allocate ACPI PCI root_ops dynamically on a per host bridge basis but failed to update the corresponding memory allocation failure path in pci_acpi_scan_root() leading to a potential memory leakage. Fix it by adding the required kfree call. Fixes: 093d24a20442 ("arm64: PCI: Manage controller-specific data on per-controller basis") Reviewed-by: Tomasz Nowicki Signed-off-by: Timmy Li [lorenzo.pieralisi@arm.com: refactored code, rewrote commit log] Signed-off-by: Lorenzo Pieralisi CC: Will Deacon CC: Bjorn Helgaas Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -175,8 +175,10 @@ struct pci_bus *pci_acpi_scan_root(struc return NULL; root_ops = kzalloc_node(sizeof(*root_ops), GFP_KERNEL, node); - if (!root_ops) + if (!root_ops) { + kfree(ri); return NULL; + } ri->cfg = pci_acpi_setup_ecam_mapping(root); if (!ri->cfg) {