Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9108630pxu; Mon, 28 Dec 2020 06:52:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJw6AA8OrY8Z1en9E47wqAmCU6FQRJygj2PLRhrQXWpvtMhnZdYGfHdfisKZcmtqq9C3r8 X-Received: by 2002:a17:907:1607:: with SMTP id hb7mr40850131ejc.81.1609167123176; Mon, 28 Dec 2020 06:52:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609167123; cv=none; d=google.com; s=arc-20160816; b=pnaK1eAipiXbC8IM8yO9MqVyVOjug+VFgD1jkI3H6oR2DV0lFVkYREubWDikI4OVK4 TepnPsaHVqmjuPAUhn3G7zClMY/hsJHbUYlIq2u6X3065Z7bdh5vGSaVlL4oqbYSR5/Q ZuFDZuLXB/DZ0QRjtgdQtnucUeLoxuhLpOJuvRUpbYRn7Pc9tioY77J7fwVkJ4639WN9 XgWuuP+5DyZ6hwTdt1bNpdd17vxfehtMzuJanOXA7rAjXXF8nc6BnvmM5s19TnnYoik4 Mac99yKnJ5i2lY4GG6R9pYp8yjdq3FWRM4hiz3hUzkHxPK0853CEPCHP+mb1Gre+73SR NP2g== 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=3JyYi3vSiRUSFrC8BJEE0sqmeYMuVOPlizYe3v606vc=; b=iMzW5icgAe2y7x18fp62eqQgdlBe6SZmyikhXrDdAM9OUim72mNtxX8Ks/tRiYIuFV 4YDrmc4j4e3nLU8H1K+nAHvVMcC0Q+g0WhWfHZlc3DeFs/WOXbKBJfqktrPDyQBqRgYn lXb3Wr9S9EWgtSysYzKgHGrbPP4RSb9cLacV4U+tAveq6KfcC36dst4SZa63PK9c8ubZ Ryv5hb1nEL+FTZMtxsOFe+uBUiWbKZ3m9pBK+4xcnOn0BIGzzM67o1xrIr10o3hNTLuv sBQX3uH/WJJtnD1h94qPWd7pgPdH+XHK7PgMWedTxA7h889aLUqKEsRkziQdmDlXKQlQ LVxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VgRglz3U; 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 h19si17762692ejy.455.2020.12.28.06.51.41; Mon, 28 Dec 2020 06:52:03 -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=VgRglz3U; 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 S2392420AbgL1Otp (ORCPT + 99 others); Mon, 28 Dec 2020 09:49:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:57246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437978AbgL1OVi (ORCPT ); Mon, 28 Dec 2020 09:21:38 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4DD62208B6; Mon, 28 Dec 2020 14:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165257; bh=+uMgDeA9w8OnEA/mW5D3fzp7g8ppSCKBUrhmboa7jSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VgRglz3URPCL0EZ/g0KnZHe/PcPSsCdtmTwYJCXuo6A/Q5z1nnJebJFxGXBdyUbDb 3M8Op2XEGmM6TkpPq+0UO0iLZSU7z+xgK87/1jqrIaBjExxsJxBKbaMJsFZ6mp4biF nCLrEeRx1s1FltuvLqUyvcJyflkt5s7ASZ15Zxdk= 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 5.10 468/717] 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:47:46 +0100 Message-Id: <20201228125043.392973964@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 862ea44beea77..5ed80d9a6b9fe 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -828,13 +828,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); @@ -893,6 +893,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: @@ -911,6 +913,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