Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9274387pxu; Mon, 28 Dec 2020 11:05:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUzdFzYBd2MnC53eCIO2zPATQTZGpLAes7QaCZFw0RleXM6r74VIuc/FXz8ACkFuKEIvdd X-Received: by 2002:a50:e8c4:: with SMTP id l4mr42999293edn.337.1609182342356; Mon, 28 Dec 2020 11:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609182342; cv=none; d=google.com; s=arc-20160816; b=X5Z8Qn/jxVQ/q55y9zMEv6WQO0/OceMKZ2hYvZttwOOVwn/ApBwatacj1AFUN5s+De KThUqYqHwiHfZNkRBMyiDutCBX17rtesEJio3UKdPVc04D3L47h7Qj2Jscbnh17vARfj LOAaXIi5jMGPcOvJhUSVMNEJt0O6lp8SE+SsFgCjajzKeky0RdGTm0vUonyPqVfhld/D HdM1y/IaQdFSMlKeLNWdQ5npHzIn3GKyReaJ7S3QwJ6cWtyeTU4KuPnTMnzW5nUzeixX fmch1TDOalzbr1AlU4kY6Ix3gOwX5XBSdFxGlMzTs9AqifDXF9RXxD66O76/0pZ3mjrG 60OA== 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=zCDJ9lXrrgR6B2c3YPz55R1WfoOzJUOyGc1ZbA6w6S4=; b=MglVSzYwhdMuByEpaXnLbzfsXj4RchMdrQwQfO1x5ZJflu366D7so6rtDP3eHqsm69 KUant2t2uUBJojQnd7FLgNGMtw2TpF1Kk+3xRYPElKCLT4ViCVoDeTPZdveToowYfIoK XrQ/x8kbWxgw7oRRnD+W8ULnUgQuagNYy02rmkDZ0jPk2e12GsIVYzk8y/SxlBQFqGUv 41lKij1HisM6odPZuh5RJq3CtavtIjvfalyiKZlUiqkph2l3T5JuKPG2F0ke3cTAzBSJ 9IIrGac9NvmxgOjGsy0PlvwRZrxB1RfDwzRKqAJLwIYKzSbdI7jknhh6emvF1rNeirYG Q49A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xsJ4DCF3; 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 u26si19124700ejg.642.2020.12.28.11.05.20; Mon, 28 Dec 2020 11:05:42 -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=xsJ4DCF3; 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 S2406879AbgL1Nv1 (ORCPT + 99 others); Mon, 28 Dec 2020 08:51:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:52814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406787AbgL1NvP (ORCPT ); Mon, 28 Dec 2020 08:51:15 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0C1F8205CB; Mon, 28 Dec 2020 13:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609163459; bh=LPSr3OeM8MJl3yOVD3DmK3SgQLLLiSkciydMM+9pd8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xsJ4DCF3/0Y5RSBWGOLP1cGQDDG3GrOpcesH9JVGnOaRxj2P2tDH4/NA4mExz4Gb0 H2k4VnAZ5jQo5YxYNtvd4DM/5TZmqOm5md607lDSO4ML+hIU7unSW/ykl/Ok1+J+5D 5OlqEqbVYVr94/BHiNr9BBBqMKJt93Azl5/i2UXQ= 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.4 293/453] 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:48:49 +0100 Message-Id: <20201228124951.303092806@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124937.240114599@linuxfoundation.org> References: <20201228124937.240114599@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 ff318472a3eef..95155a1f9f9dc 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -845,13 +845,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