Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9181611pxu; Mon, 28 Dec 2020 08:36:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyepkOon3/BKM19+FiR8u7O26PaHKAXNYOOG0SmuwjO8m6UC6nqKGQ16OY9Ti6teTHgU/RL X-Received: by 2002:a17:907:36a:: with SMTP id rs10mr41507231ejb.411.1609173397318; Mon, 28 Dec 2020 08:36:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173397; cv=none; d=google.com; s=arc-20160816; b=DKizrchoRYn0A0nxDe3RQvub481wSxH+Xvm+iWBkWEgjwD+Yai76hA642wW2+tTZJt Nv6X8WjZMpxPOP5PKx3PBZKnDHLZTEln0XdSfbtbB99XNEF/mQzrrLLEfDXMfi82Nft6 kxnRekDez4W39fzXPUinDESsJcfLdnnUEjC7l1xtkVa9nHunPTbfYshcIOtwed0H/gqR Y5zk7dslr1/56obeNWlTUwDLpXs01ibXNmMj5pD8eV2HbS3yVtL2jRmY62x6QHJLj4nC AxFKIkSAey3v61onO+QP1hX3zRZcu+J0VJLwoua0Ugf1LeFqCqO+Fo7X09wnbbqL/Tcj bmYA== 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=uSiNRpMm2nmIF9yy1VgoA8FI/VDdsmqvo0CfkkYOULM=; b=NYy51ySBSZX+WBh3YSQrP5pnIvCnREiJzxZbs04ggs/T1h+3wK0L7K0H8qcHHskdsQ Trfy/QXw3KW1LnXf9THriSgyzRlsVBpGGX0PfHIoLFwgxhwVTC+Xj+GrxXXRoToOigOB eH7mkZJzF9y33NeKDROt0fD0mFB0BfCxBFIhgCn6cpsKl294+YHaYGrJdnfpzcScPidO 516WdaMHyGg21YAeQmrgIEEcR5REC9r5epk0+OTqvSdqK4wzNa7An6GGHM0E3JjKb+Vx I5FP5FbQ3AaI7B7WDGS/Jz//fePs4D+NMzwd9hyDOB3sxn0rGIL4GTACKJWD3orWE+6e tZJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kXdBXouq; 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 bt25si20989308edb.572.2020.12.28.08.36.13; Mon, 28 Dec 2020 08:36:37 -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=kXdBXouq; 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 S1730556AbgL1Qc5 (ORCPT + 99 others); Mon, 28 Dec 2020 11:32:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:33336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730620AbgL1NFb (ORCPT ); Mon, 28 Dec 2020 08:05:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0AD36208BA; Mon, 28 Dec 2020 13:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160690; bh=tMxKk1dA9zroC0Ot3nMh5RXMEalN7FryCBJZmPAqsSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kXdBXouq6+NsuWu9aesPRizOLAfMlsZWbobl8dGqTvqWCFAlkddlNtrUUy9NQ+p9i GmYoqowYNg95BdCadebs70eGUFPoIzu2ipRpTFEOyHzcnEpPpKrN+YvX9tjnZ8UsjB ZJIJEkGcA3bQ7o8BFiaopUBmsXEpgQ25ZGR7QpK8= 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.9 120/175] net: bcmgenet: Fix a resource leak in an error handling path in the probe functin Date: Mon, 28 Dec 2020 13:49:33 +0100 Message-Id: <20201228124859.072412064@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 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 5d4189c94718c..2921ae13db283 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -3433,8 +3433,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