From patchwork Mon Mar 20 22:49:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9635395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8DD0A601E9 for ; Mon, 20 Mar 2017 22:50:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C75223201 for ; Mon, 20 Mar 2017 22:50:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D7A9277D9; Mon, 20 Mar 2017 22:50:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F299523201 for ; Mon, 20 Mar 2017 22:50:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=gM8z5h4oz7viSJgAdJbPvJG4lL2DmOJ8R3TfKj8vkrk=; b=GBz HUsAIbUZCVpZBQleA5skWxSPU/ycaZ3jIVxGGOlJiEjgnQ6CbEOoWJHRzGwzbW3zW5rR1+W3IGiEE 4nHyff0nPtg+iGUeFgvOn9fz3cMxIb+50Q+7f41SBHMf5gvvUODzx0SW/3o7hVyA9fQWbQqoBET+A 8yatgBfgZBTkesuAci+PeA6XXRrXXN7h9doe809oXNaxSluyTTFuDIlpapVQM5svsA/Qu5OeZdbKR 4gqgRmfpuMQluW9PPjIdeKypPxQcXY22zvZPG7HPwJ1etkdklIZTaVA+IW3nhnGTktAG/gJ1ql5Nc GyLr8zd7Jq3q4HCYqgCGzlgSdh+5rPA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cq67z-0003Wa-BM; Mon, 20 Mar 2017 22:50:15 +0000 Received: from mail-pg0-x230.google.com ([2607:f8b0:400e:c05::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cq67w-0002Iw-11 for linux-rockchip@lists.infradead.org; Mon, 20 Mar 2017 22:50:14 +0000 Received: by mail-pg0-x230.google.com with SMTP id 21so50996142pgg.1 for ; Mon, 20 Mar 2017 15:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=1ANmi3o6qGrW5i+7YubT5bAsFOcu9UhUOOglsvMJKHo=; b=e2b/KGrhWRkEiLEL1Xct1BPczNKFWsBu0S58BbJRFxmH/W29Ln8MONIIacPUJZdzQB E/GHUUzrSs0Rui8X+wpmk2bv0tK6kfBSOgrFtjxEzQ9a8HN6oUHvP8jeHmg8Z7dIs0e6 RSmU0sFlk8yWTZzRObbrAQVj1o3IH1IbK7OQI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1ANmi3o6qGrW5i+7YubT5bAsFOcu9UhUOOglsvMJKHo=; b=EL42diY4gF7iCtjeO97E1s0IvkKi1vYYkNOiho3PazQmFY85o24zH53rYhJbQGrsxX fqulELbVtrZo2MSB2OeIalIYaOf6uKSaA2pnSNDnGh+NvXkEwgfIaUFTmDOzKqZokgZj YR72Vil6JMw/hXzkLvY+bc2abocqgKYeZxjWBHou163zdwDzgS4gbW3XjsVofDV1vZSS AtpxSbkB0GdaiARKH1hdNfDNa5ldyu8ztPsEqSKCHasRv5jDmWieDqWVBApy2fWl8WD9 uecvG80nDEb0L4z+wj5/KBM6apmefqB9oWuurMyrtjQQivtW65Hyy8Bso0jlttz/jE1D qoCA== X-Gm-Message-State: AFeK/H0n5g/dyetrqfjtUa4xZCP34zKsl23QezFjCtOLEqfStw9ZLq6nvo1w3DjV+cSolb23 X-Received: by 10.84.202.163 with SMTP id x32mr42702797pld.67.1490050190452; Mon, 20 Mar 2017 15:49:50 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id t70sm34945654pfe.64.2017.03.20.15.49.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 15:49:49 -0700 (PDT) From: Brian Norris To: Bjorn Helgaas Subject: [PATCH] PCI: rockchip: don't leak the PCI resource list Date: Mon, 20 Mar 2017 15:49:36 -0700 Message-Id: <20170320224936.28605-1-briannorris@chromium.org> X-Mailer: git-send-email 2.12.0.367.g23dc2f6d3c-goog X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170320_155012_110284_A6444D8A X-CRM114-Status: GOOD ( 10.17 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jeffy Chen , linux-pci@vger.kernel.org, Shawn Lin , Wenrui Li , linux-kernel@vger.kernel.org, Brian Norris , linux-rockchip@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This list is local to the probe() function. We should free it up in both the success case and the error case, but currently we're only freeing it in the error case (see commit f1d722b607d6 ("PCI: rockchip: Fix rockchip_pcie_probe() error path to free resource list")). Caught by kmemleak, when doing repeated bind/unbind tests. Signed-off-by: Brian Norris --- drivers/pci/host/pcie-rockchip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c index bd6df7254de4..8087a0698d65 100644 --- a/drivers/pci/host/pcie-rockchip.c +++ b/drivers/pci/host/pcie-rockchip.c @@ -1396,6 +1396,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev) goto err_free_res; } rockchip->root_bus = bus; + pci_free_resource_list(&res); pci_bus_size_bridges(bus); pci_bus_assign_resources(bus);