Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp12062ybt; Tue, 23 Jun 2020 13:59:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7B8nZ78XD8vDQTQ069Mmoo+kMpP8j4yTgCmTiQHDmSa0g4H/0b3XJt3CH42xny1auKYPh X-Received: by 2002:a17:906:6d56:: with SMTP id a22mr16564736ejt.440.1592945969302; Tue, 23 Jun 2020 13:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592945969; cv=none; d=google.com; s=arc-20160816; b=yKUO5K2QN0Hq/0u1hJkEcVA5civQozYK5JiGtD6Xh9SPT/zYeDV7xYtfeSD6cFhUsC 8BSHpri5nIiZbQoiEqLCsjwnwKkjEoF4RpwLzFr4adg1oF8NzPWCzPVMxq2CauXiGN+y VrdU8PgITaUotdeBQ3JnB2aQRlZW6BV+dVML+kQYEqdhHL4nPr8jwanNrOSAlZ50oqmo pbF9RDRE8wY3ekqYq061rvigAkAVBNAp+5a996DM3mIvhc5kdOH8Utl/3m1W7BmnLJ5v G3vzU1vO4088CWJ1vhXYNanPr+ZekTiSyDdzma1xeVv3Etrme9+VExtBzHIZYVL2g7qP KM5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IBr9qQzQya6Y6AQokN0TStyWFAPYbkKWzrHOHs5W3/Q=; b=rsCAiLJNkCVy1tEwwrBchnT67GA0F/USqg+HTXKTs+oWG2G66EXiI5GzVRRLB9VduK 1XBvC/THhc1m9U5MI7anX/jGDDptxVH1QVz8mlqlTNuEjk/6F7f+LIczRBU6PywCTcM6 tXtm/k+savX44bwbWuKdH2BXS+t9dxPjPApWOrJ8/r/nyOkWqVsN7o30I9xhNgYrGuji bZXGwpguuypROHVkzUbpigapkXt5RMMN+/ULF3u0d0jHVee2ZVrDEK+8qpW5CQEnSja+ supmwBdeAIxwe9VZkOLrXhuNN0CFI4hX04p++yA0mP374nly9xAxHPHV68o5CWO781jF paBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wrcFvdmL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l91si4827832ede.155.2020.06.23.13.59.06; Tue, 23 Jun 2020 13:59:29 -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=@kernel.org header.s=default header.b=wrcFvdmL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392734AbgFWUzy (ORCPT + 99 others); Tue, 23 Jun 2020 16:55:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:41438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392567AbgFWUoT (ORCPT ); Tue, 23 Jun 2020 16:44:19 -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 8D1FA21BE5; Tue, 23 Jun 2020 20:44:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945060; bh=aVC0bzsG9b9HjVAWAadwDR5xt8QVdC5i7Yfqow4dtPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wrcFvdmLBImh9ELWdpRxVUcqkqew+gksvgzz0Y9wR/vs8NMW/uNN8wJz21Har4aTS ucT6+SH8zK+qW593YcJO65ezCkDMwaeWoFn2lidGL4Zv4sltKUKZCWPWuxXx9qL+Zl ls9vcydX+DOr/xIEJ6vq3fuvWzF4+tQZqWonCCkU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Geert Uytterhoeven , Greg Ungerer , Sasha Levin Subject: [PATCH 4.14 023/136] m68k/PCI: Fix a memory leak in an error handling path Date: Tue, 23 Jun 2020 21:57:59 +0200 Message-Id: <20200623195304.796176655@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195303.601828702@linuxfoundation.org> References: <20200623195303.601828702@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit c3f4ec050f56eeab7c1f290321f9b762c95bd332 ] If 'ioremap' fails, we must free 'bridge', as done in other error handling path bellow. Fixes: 19cc4c843f40 ("m68k/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks") Signed-off-by: Christophe JAILLET Reviewed-by: Geert Uytterhoeven Signed-off-by: Greg Ungerer Signed-off-by: Sasha Levin --- arch/m68k/coldfire/pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c index 3097fa2ca7467..1e428d18d268a 100644 --- a/arch/m68k/coldfire/pci.c +++ b/arch/m68k/coldfire/pci.c @@ -316,8 +316,10 @@ static int __init mcf_pci_init(void) /* Keep a virtual mapping to IO/config space active */ iospace = (unsigned long) ioremap(PCI_IO_PA, PCI_IO_SIZE); - if (iospace == 0) + if (iospace == 0) { + pci_free_host_bridge(bridge); return -ENODEV; + } pr_info("Coldfire: PCI IO/config window mapped to 0x%x\n", (u32) iospace); -- 2.25.1