Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9039239pxu; Mon, 28 Dec 2020 05:08:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQTvBw/UKD/9z6ohV+RUO07RG/zQIUFs40viLtihm/dhro5CWpTGyGn+hrklU6xVe8mpLW X-Received: by 2002:a17:906:d28f:: with SMTP id ay15mr40114994ejb.327.1609160926265; Mon, 28 Dec 2020 05:08:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609160926; cv=none; d=google.com; s=arc-20160816; b=EPlKtrOkAkklGHzIRMdQvhwVhJNoL9+wf20a5znnjRqXXvos78nzfTHY5zzlEC679k ekIEftiOdpRvMfNz8eujOlGRjnHi5/Z1T7BftWWOGJgPWR3YDCxxez7ymScw6/h5OpoL pVyIyxxmfm4PJGXU3mk2MEJutuVeFOlXdbEDaRHnOJNGtRW32oaXOreVu0k7O6mOXjhO vXgIDQNz/iPQA0BaqKcqy3lo17qqm1/zjPElG5ba7h2TLSbmbvJx4Um3a2mXFCfjaCc2 e4PoCwuBJr7he7w30sZ/NCyve2IRD17v2wZH7WP3jDnyS9ewZnS09SMilVu3aVbScnhV OgSw== 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=MHDGJoDhq/0aMZmzDYnqrgZPcgD8u52NFs1s2QO4fuo=; b=oT6LV4Ry14D6xstHx9cbtd/zHgSBGXKuyZDT+kAwinwCJ2SrTmPlRYL+BTFu4vuKhn M9boBK5PKSlEo2ZFh8XoDVJafKTUnl1w7V9Wrf7XriyOF3NWgmTGiFM5FzksNu+SfznR EEEAML3MFyEN7aVfzA5xtXQdVJ5AZD2f+6B5yU8hO4DhjBznMWlGAUD3vGCuvJjESum1 ulbyWY9W5jb7s3J4rKUojjffyt+QghsXd40IgA+ZTcS0rddzPJijVqZL3YUtW0USG1V0 ooxSBdCGd+dzeA2kWZXfynJGNeYejcdzqKBOgmmOX7wdj8fClUZIU6QtlpvvviqA4+HJ BW0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vj+rPcQh; 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 z5si18843942ejj.549.2020.12.28.05.08.23; Mon, 28 Dec 2020 05:08:46 -0800 (PST) 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=vj+rPcQh; 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 S1729650AbgL1NGe (ORCPT + 99 others); Mon, 28 Dec 2020 08:06:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:33858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730649AbgL1NGD (ORCPT ); Mon, 28 Dec 2020 08:06:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8ED04206ED; Mon, 28 Dec 2020 13:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160722; bh=nut+FdKbNn7Tk8axI6IDJ69X2ebRDC+tEa8dll2K1zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vj+rPcQhZDYtcmGhLAvCKheUpN65IUBntHILDDsyCl8FG73EkISwu1E6P/3ImWX0C MG0AXLt/vtIxGSNr7f2VKWa0GfeGb7cpzLQERBph0xO/j0n+lNIOuTOyEcvXtaUS1Y NEfTiVAPi4Yln6eSeHMa8ViPqSJzYUdWizC5egVg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.9 121/175] net: allwinner: Fix some resources leak in the error handling path of the probe and in the remove function Date: Mon, 28 Dec 2020 13:49:34 +0100 Message-Id: <20201228124859.122157097@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 322e53d1e2529ae9d501f5e0f20604a79b873aef ] 'irq_of_parse_and_map()' should be balanced by a corresponding 'irq_dispose_mapping()' call. Otherwise, there is some resources leaks. Add such a call in the error handling path of the probe function and in the remove function. Fixes: 492205050d77 ("net: Add EMAC ethernet driver found on Allwinner A10 SoC's") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/20201214202117.146293-1-christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/allwinner/sun4i-emac.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 672a8212c8d96..3dc101f7d6bd8 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -827,13 +827,13 @@ static int emac_probe(struct platform_device *pdev) db->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(db->clk)) { ret = PTR_ERR(db->clk); - goto out_iounmap; + goto out_dispose_mapping; } ret = clk_prepare_enable(db->clk); if (ret) { dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n", ret); - goto out_iounmap; + goto out_dispose_mapping; } ret = sunxi_sram_claim(&pdev->dev); @@ -890,6 +890,8 @@ out_release_sram: sunxi_sram_release(&pdev->dev); out_clk_disable_unprepare: clk_disable_unprepare(db->clk); +out_dispose_mapping: + irq_dispose_mapping(ndev->irq); out_iounmap: iounmap(db->membase); out: @@ -908,6 +910,7 @@ static int emac_remove(struct platform_device *pdev) unregister_netdev(ndev); sunxi_sram_release(&pdev->dev); clk_disable_unprepare(db->clk); + irq_dispose_mapping(ndev->irq); iounmap(db->membase); free_netdev(ndev); -- 2.27.0