Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp917040pxb; Wed, 1 Sep 2021 12:37:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6tTVP1Ik81W7zxUy4KdpfVtCZ5EBdglPTeHj3JuTEnZYX7YBIecrIMFCX13HTs/lBhdU2 X-Received: by 2002:a92:c786:: with SMTP id c6mr772179ilk.211.1630525052812; Wed, 01 Sep 2021 12:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630525052; cv=none; d=google.com; s=arc-20160816; b=WtYdQASSj4VI1XxYfTM9iMwnOfPh47YPP1TpdhgoJ3S8+MxVsE5XVYyb3MG15FUKLm q+T2zc3UgTUzaVumjxi+CkeLdVy6U/WrmamByPSVh+u2+vIqcBk8iA9fnj2yZ6A8I8EX t30IUNgYGVWGL7/KZGP6rO2hh57xmbACZtwjB5vfQGYnHXwnROoxH1a1ZJMF26j4lh3w bUpXr5p1TJyaaGeqx+AnxwiWH6GPGR2enTONqA0eWOzzmENjyJxCZOLgAmajvInoFBME R0HQWGvXFkfO9IoZW0aM5CVF5p8fUlXVi+hADeRPbjUa9YYwnyTVyfCk/IgsB+w1Ztia dIJQ== 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=yIWW/8UrGX9ASNZ3va8ZCoZo+Vi/08iLiMBdi3xZaCA=; b=u1AwJA2stTDN18kYUO+89mhkqw50MBwzP730cnrR9DJwNGbbWDZsVC9YXMCK1BsCD0 VX3Xi/27juNaaEbvlKQtsP9lEEn8uHvuC1wRDD89nCruYlE3qjRrfaz+27FD5bGdAdc9 v+Va9PTVgN9MTNHiL2Zcv9Pn+4gRtZWmLeRs5eR/KwhB7GhdloaqNa7tFTT23UlPbW89 QkRZn1bAtlYGNLAjlCOh8m3JDLIM5zyjyksvbmeWXcnOon+NoAoiyUhIoMtV2GIgQECt G0UhR9Z8DgIlkY0umSXQ+jqlIHOgkwpBk44gBpedshslXJ9NJuY01BgvpzDc2+9WCxvV 0ufA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KtI+iVOm; 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 z26si396830ioc.55.2021.09.01.12.37.21; Wed, 01 Sep 2021 12:37:32 -0700 (PDT) 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=KtI+iVOm; 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 S1344876AbhIAMnM (ORCPT + 99 others); Wed, 1 Sep 2021 08:43:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:42100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344034AbhIAMhV (ORCPT ); Wed, 1 Sep 2021 08:37:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0C3E961139; Wed, 1 Sep 2021 12:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630499652; bh=GSrMGi3p2ZVGJglgw3oyssmrlkN+AUsMS7KZAjFK5ko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KtI+iVOmjwB9tRPj690f9U22bc0gawz0UaIcEKDwqrAAtaNgg3tm3oNGI6mpBnvvG z32ympZRpgtoeSLVoOpQ5j5LRMdgGs7D9PnYxFFsFbVXrtIoFLwV6WFzzOJydGfjLK QLCAVRMlJUyufxW74Zv1oez9ZNHkB1f5Y2mqJ+9k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 034/103] xgene-v2: Fix a resource leak in the error handling path of xge_probe() Date: Wed, 1 Sep 2021 14:27:44 +0200 Message-Id: <20210901122301.701921365@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210901122300.503008474@linuxfoundation.org> References: <20210901122300.503008474@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 5ed74b03eb4d08f5dd281dcb5f1c9bb92b363a8d ] A successful 'xge_mdio_config()' call should be balanced by a corresponding 'xge_mdio_remove()' call in the error handling path of the probe, as already done in the remove function. Update the error handling path accordingly. Fixes: ea8ab16ab225 ("drivers: net: xgene-v2: Add MDIO support") Signed-off-by: Christophe JAILLET Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/apm/xgene-v2/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/apm/xgene-v2/main.c b/drivers/net/ethernet/apm/xgene-v2/main.c index 860c18fb7aae..80399c8980bd 100644 --- a/drivers/net/ethernet/apm/xgene-v2/main.c +++ b/drivers/net/ethernet/apm/xgene-v2/main.c @@ -677,11 +677,13 @@ static int xge_probe(struct platform_device *pdev) ret = register_netdev(ndev); if (ret) { netdev_err(ndev, "Failed to register netdev\n"); - goto err; + goto err_mdio_remove; } return 0; +err_mdio_remove: + xge_mdio_remove(ndev); err: free_netdev(ndev); -- 2.30.2