Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2354643pxb; Mon, 20 Sep 2021 19:54:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxk+lOsRMF3lS493/AjK82XVoV4UcFZlYO7ZAjlagTj+RAgazM8dMIUXeW5sstlf4436VwR X-Received: by 2002:a50:d843:: with SMTP id v3mr1314528edj.254.1632192867410; Mon, 20 Sep 2021 19:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192867; cv=none; d=google.com; s=arc-20160816; b=BcKPClZ+Srrf+NE2em6j+D/phOZY3R1HZrmjp4TpKHHBvobvGFhuYJv991Et3VEYWF ijxw+aUUWneIq7q2LWZbllaWBQgqz6aWq8TXax2g2J0czLgrITXuAmhL+Xbh8+cQxXJn lFFU5wnaU1H7HK7+1IgU82UFD5GSp3w8kEOVYjl2ODN8jK8IBo07HaAExfzTRgckqkQk LPIemuJv1URpwaKk+fiKy10KalMfktuMDYz3gX1Dbf49Vn70SWG/IJQ+8yvPH4MjGw4/ jvQ21Ykrnk2tbb1qkRHNNvVyMhfHCN6SEx7v3s8REWaGfLpWhI6UVwLX6QAqmkcGEnmG l4yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QiFySL/3u7NSxJ45g1tNpfLVjmx25AbmOqCiTYauxKY=; b=gt+gQVZINuSJuCTAz9ai9jHI8G0zmfgUvd2GA6WvSdFX1F0WrEMri3GAAtmRznHBeN UztaPamJUnuAa4X/WnNoW1kVcv6yIjyk+OwCm36rB2wtY1SknhAvWOkXL+CHOOnSwtXA mTAYeW6Z6ryWF+uGUuzFC/WaAWv1YJVmRZwGWd228BIX2NoebQbnP40zUdsq51+buFGo 6RVv0kox3tetNp96haMBR12FVDCVxDqfHffFZ87YSEN1XTKWF4H+EnyWDDZ3yy4TDklV ccgwaitTMF8IqKfsbKSUqI3A0PTWZFqMWZFrC0+ZaEjut86krTt2QoOeVSUgU8mfIiV2 /CmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j7eVYcaq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ne20si10494663ejc.429.2021.09.20.19.54.03; Mon, 20 Sep 2021 19:54:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j7eVYcaq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350802AbhITSvk (ORCPT + 99 others); Mon, 20 Sep 2021 14:51:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:59830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383917AbhITSqP (ORCPT ); Mon, 20 Sep 2021 14:46:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0BC5661AEC; Mon, 20 Sep 2021 17:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159183; bh=mv/mgaHOnkOGkztlyC9ZkuUY8ikq0GtV8Y8kFRFjK9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j7eVYcaqLNqlFMmdIyrtNNY2gmEZ++9AzP+YG0hnO+u1aIEXmxpTH9QmiSPhNTxL3 zI2WyqEKPcFiNPPVCkCpDjrutbSOOlgMw5/UV32Pmz9K2oirOrMr4k0uMtyJ4b8fcz rc/Dob/epa82deLK03ezDSKz0Z1FB3XOOiKh2OMg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Lorenzo Pieralisi , Vidya Sagar , Sasha Levin Subject: [PATCH 5.14 097/168] PCI: tegra: Fix OF node reference leak Date: Mon, 20 Sep 2021 18:43:55 +0200 Message-Id: <20210920163924.818553733@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit eff21f5da308265678e7e59821795e606f3e560f ] Commit 9e38e690ace3 ("PCI: tegra: Fix OF node reference leak") has fixed some node reference leaks in this function but missed some of them. In fact, having 'port' referenced in the 'rp' structure is not enough to prevent the leak, until 'rp' is actually added in the 'pcie->ports' list. Add the missing 'goto err_node_put' accordingly. Link: https://lore.kernel.org/r/55b11e9a7fa2987fbc0869d68ae59888954d65e2.1620148539.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET Signed-off-by: Lorenzo Pieralisi Reviewed-by: Vidya Sagar Signed-off-by: Sasha Levin --- drivers/pci/controller/pci-tegra.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c index c979229a6d0d..b358212d71ab 100644 --- a/drivers/pci/controller/pci-tegra.c +++ b/drivers/pci/controller/pci-tegra.c @@ -2193,13 +2193,15 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) rp->np = port; rp->base = devm_pci_remap_cfg_resource(dev, &rp->regs); - if (IS_ERR(rp->base)) - return PTR_ERR(rp->base); + if (IS_ERR(rp->base)) { + err = PTR_ERR(rp->base); + goto err_node_put; + } label = devm_kasprintf(dev, GFP_KERNEL, "pex-reset-%u", index); if (!label) { - dev_err(dev, "failed to create reset GPIO label\n"); - return -ENOMEM; + err = -ENOMEM; + goto err_node_put; } /* @@ -2217,7 +2219,8 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) } else { dev_err(dev, "failed to get reset GPIO: %ld\n", PTR_ERR(rp->reset_gpio)); - return PTR_ERR(rp->reset_gpio); + err = PTR_ERR(rp->reset_gpio); + goto err_node_put; } } -- 2.30.2