Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9045209pxu; Mon, 28 Dec 2020 05:17:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzSRn/6p0VbzaQqQH6sgny5YdmzGkhUgRslr2wXVgaqFyLBxQWoFrzRinebDdVK5xMZoQo1 X-Received: by 2002:a17:906:30c4:: with SMTP id b4mr41023297ejb.456.1609161464234; Mon, 28 Dec 2020 05:17:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609161464; cv=none; d=google.com; s=arc-20160816; b=nCxULSdHst2Ta9gf7fFOZaSdp4pjNBsgTa9pypMURWmHsloJgf9T09yziAPpTeJV42 1HDGvoUDbencehkf86W1tzZBqLdMAtSOVD/YNqkVwnSYgevDed5QgbRyUnEzIf8CP8im EikMDQfVieXtVQAQTRyuGtAoFP4SgHizoD3UC6jmKYUcuV+9tZyMzshBsubrOpuODj2C /YIvrsDwkJ2iR73RjsVhepU3fr5CMYfh2+XhgkF/SEsH+6F4pCFnU3ewPI2TK5vB0VmX TNIZiMUPvJXgwE1TOAoNkHnf4VbKNiuz338G4x/jvRPZdk2E4B9ciQTbsUPwWZiEX4Gh l/Og== 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=kLDKgBi65+qVbRXEA6+rhxVs0thVnDz9BEe8qx3tk/4=; b=z/tI+v6jS0QFWCGJZE5Q7g6tahOKMdpyfYosGrue8QT/sEYI5TNrslllaWRZw1odp2 F9RL+7zomIPzH1+C2OqTVTbHUmaJp1LXYICF5dvJXomVSPT+BHa6JgMKwa+N8CIkM2PA wm346u8VfJV0HZC8vAgD4t1NtBNhFJwVYTydxvQdGdJwHa0UQihMCopVP0CqObIKDVGU KXCfFxfd9g0jfDhtZlXc7zkUzLx9c1uhGlDrpIdBB/hJiaoxsm574fmiPOg6T4W1HXau Yka1UGW5E91nlbdLh1cAcVlQUlnmSSDyQnPJdaS0dWvGMZWki5k8GurQYggFndbV0+jt mrjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x1xVUCnO; 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 p24si20308853edw.475.2020.12.28.05.17.21; Mon, 28 Dec 2020 05:17:44 -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=x1xVUCnO; 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 S1732720AbgL1NPj (ORCPT + 99 others); Mon, 28 Dec 2020 08:15:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:43892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732707AbgL1NPg (ORCPT ); Mon, 28 Dec 2020 08:15:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6EE67207C9; Mon, 28 Dec 2020 13:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161296; bh=etFg+hdY9cYDgYnDmZBzPds9btDoJxw4EV86C3JFYyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x1xVUCnOJAfez7ayxa/xon4EW8Y72F2M5X7k5gzieZrKZDi4lMX9tvp10d/UtEZB0 PGDRSElVGaCPtRey3r+YCwoAO5UDmjznEFmXrUnU0+DzCrkA+x0Jzr8WjDiz3ErPT5 yelRYoaGXkMbMXk+etvnI1TBXALQdnUWnNiLxKUI= 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.14 166/242] 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:31 +0100 Message-Id: <20201228124912.873105684@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 c458b81ba63af..d249a4309da2f 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -847,13 +847,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); @@ -910,6 +910,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: @@ -928,6 +930,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