From patchwork Tue Jun 23 19:55:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 223485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6230DC433E0 for ; Tue, 23 Jun 2020 20:26:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36E8B2082F for ; Tue, 23 Jun 2020 20:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943967; bh=LqXoPAKS6pHMH0wXYUQDjax07COwK/Y2Q/NCHGyioSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0OcSyecPVILxoxArEmggFpr8cgahLBF4ledIZD8rlJcaBAX0gXB1p97rEZF9/fk+X 37JspAQyAr7uWiONXbax8s038F4qDRnI6YPxGU5xjrwRIM7vlM9isvZzx/+IDvovsB 4Jv8wHa2O6kiaOWQPlu2IBTLG/FJvIscZ57MzVLc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390596AbgFWU0F (ORCPT ); Tue, 23 Jun 2020 16:26:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:45072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389707AbgFWU0B (ORCPT ); Tue, 23 Jun 2020 16:26:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B0FFE206EB; Tue, 23 Jun 2020 20:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943961; bh=LqXoPAKS6pHMH0wXYUQDjax07COwK/Y2Q/NCHGyioSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p0SpgXGZKI2gt+vKmLneM6XY078p0MErQVKwhyDn6YK/ewqHt8nDI9I8bVH4lLBLw DLl2WesLYZuCf5Gd9wp0IFcbRtAEpFkNCDkKReDZBOoyFs3tg8kendaNVXE7Nviue4 VmaQOxco1TrzE6mI5o56mSFyo0wNvhJbJ/DA9zgs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Lorenzo Pieralisi , Linus Walleij , Sasha Levin Subject: [PATCH 5.4 118/314] PCI: v3-semi: Fix a memory leak in v3_pci_probe() error handling paths Date: Tue, 23 Jun 2020 21:55:13 +0200 Message-Id: <20200623195344.499092884@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christophe JAILLET [ Upstream commit bca718988b9008d0d5f504e2d318178fc84958c1 ] If we fails somewhere in 'v3_pci_probe()', we need to free 'host'. Use the managed version of 'pci_alloc_host_bridge()' to do that easily. The use of managed resources is already widely used in this driver. Link: https://lore.kernel.org/r/20200418081637.1585-1-christophe.jaillet@wanadoo.fr Fixes: 68a15eb7bd0c ("PCI: v3-semi: Add V3 Semiconductor PCI host driver") Signed-off-by: Christophe JAILLET [lorenzo.pieralisi@arm.com: commit log] Signed-off-by: Lorenzo Pieralisi Acked-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pci/controller/pci-v3-semi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c index d219404bad92b..9a86bb7448acf 100644 --- a/drivers/pci/controller/pci-v3-semi.c +++ b/drivers/pci/controller/pci-v3-semi.c @@ -743,7 +743,7 @@ static int v3_pci_probe(struct platform_device *pdev) int ret; LIST_HEAD(res); - host = pci_alloc_host_bridge(sizeof(*v3)); + host = devm_pci_alloc_host_bridge(dev, sizeof(*v3)); if (!host) return -ENOMEM;