Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9172294pxu; Mon, 28 Dec 2020 08:22:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzj+AyiiX7VsZGspcWKguX3R2b7MzMraQG6ilBE2+vqAZvNtr6t9SF1d6D2IuqsXH35JMzG X-Received: by 2002:a17:906:edca:: with SMTP id sb10mr42906528ejb.284.1609172527413; Mon, 28 Dec 2020 08:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172527; cv=none; d=google.com; s=arc-20160816; b=GfkrOSnWpu4nEuF00A9lHi1ixk6X8aPE78y30lTtI4oy+a9smMcSae4xE9uIamT2eo f31CuCWjET0gP5+LOXX8xB6P5qCuFaXhGixVnx6gM11RF3rspCjJJGY6yv9eZqHT9Gog 5xZR/OWM03lyMBRtTPaOHA8oU8SULmWeseqUHDWz4o6jqsBPbGNpDIydhpg8cTp43Sy0 A7qi3/7jEZZ5+R0vqOTUUrahTdw//pQagUTQ4jZMuSNr4x+RmoZyVk+Qx/+viqP5mtMs /2y1eeWDrfezSDnm049kL3Ul1kuTaNM0tL4cTxhMy4UfT/hYX3K/uhVTSxmouH5ptsNw hkRQ== 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=ygx5UcB2H0euVscmaKr/QFT60Z8IO7q+a0SErNhY8gk=; b=GFIcCz3/He37o7lqg/fvurNi9j0BaPxnHysf1Qmy/04aTHvYjxYhVSCEONKF5SDazV ceiODsyNHbg5RZYemWbYQglF4BVKY8379dTUnVSheUmt8IzF2NqMbWZ0+mDKZGebNnOI m2vdbh3Zr/pM75kEOA+ATEKl5V5FsWOQOhB0f/Dgb+OBO7aUff22uCeNLTBfbulaYNKD 7WmFkL0t0CMPW8Go0T0CN32uLV44YiFKd58xwm65jylNWXtCP/kNFEPReRW+EXoehoK4 K/ZBrQopKL1rEvh6hD2zJRYuV/5tyu/RWqreMeSqj/nlJQ5Q3YZHAZBE9xqLtFbzzQdw 6q4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tfPQbhYm; 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 bt22si15538462ejb.107.2020.12.28.08.21.44; Mon, 28 Dec 2020 08:22:07 -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=tfPQbhYm; 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 S2440962AbgL1QSe (ORCPT + 99 others); Mon, 28 Dec 2020 11:18:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:43822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732703AbgL1NPa (ORCPT ); Mon, 28 Dec 2020 08:15:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2E018207F7; Mon, 28 Dec 2020 13:14:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161289; bh=u7CIHf/dDFgrykRtPa391aRQl2kDb3EmGEJwUoVbDjw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tfPQbhYmDukgaJD50NMXLZdJOI/u6efbPu9eIFFQJayt4HmV1EEP9Fql7dJ27Pvsh ExHyVSYSPuabEXt2hPil6wcciNFdw/dsKmOM7fxW16kKOox1ch2MVo/guWl9ntxCa6 LzMQtQVcgOz3Y1GSZO66HwX1osBKHMLQ4mhPtDhg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.14 165/242] net: bcmgenet: Fix a resource leak in an error handling path in the probe functin Date: Mon, 28 Dec 2020 13:49:30 +0100 Message-Id: <20201228124912.823025242@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 4375ada01963d1ebf733d60d1bb6e5db401e1ac6 ] If the 'register_netdev()' call fails, we must undo a previous 'bcmgenet_mii_init()' call. Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file") Signed-off-by: Christophe JAILLET Acked-by: Florian Fainelli Link: https://lore.kernel.org/r/20201212182005.120437-1-christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 8bfa2523e2533..5855ffec49528 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3593,8 +3593,10 @@ static int bcmgenet_probe(struct platform_device *pdev) clk_disable_unprepare(priv->clk); err = register_netdev(dev); - if (err) + if (err) { + bcmgenet_mii_exit(dev); goto err; + } return err; -- 2.27.0