Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9496233pxu; Mon, 28 Dec 2020 18:44:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeXIn5a9BLjacUHFf27NXqBDPZpo9DRN5WyIDIwHjTufuRNnL9keqf4DJCwj1mmtRbWo3v X-Received: by 2002:a17:906:3401:: with SMTP id c1mr45103205ejb.156.1609209889001; Mon, 28 Dec 2020 18:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609209888; cv=none; d=google.com; s=arc-20160816; b=FXZtFup24kjPYCj2YUbXIgHNMAkIVdk7yc7tcSO4mKVPTV9dSM9AeGBlfW9cLeocVr 5dKdLc9LQ1j2vKTHlngqYy0RXvVnqHteioJ9W7kx6ixvJ8eD3ISAqhO8uJkHotoVazgS P5FT97NB5JygtcuSGM8JbwzAwUO1K3G9LnU5R4/dM0qPbYrSigwVWT+DY2ghzrvf6lhK 8e/zCSJiis8OgYaYKu9krZYI3r84Z0IlSXD4cPQ43+N5MFV6m8gP4a1E3EYsElTEGpZQ nhFr5MpWT8omSbxUbJN02KL5k+PdfOIyK4ZTJmqW4AL/ILKpHVb/LIcIOTSYgqW1qhc5 Wheg== 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=0t7UTw0Dhe+HjbVew9frGPOmYVCtrLMgW+MjZmCVFsw=; b=QiR6q8mN0IbNH+0kg/PlJBYdloMzD9KEoFpsQn47igSJ5m8zFOa/SgZkqVS6Orfjc/ P3U05Ut6r320VLTqWsnKH9hM/iFISWAtNkbA0l2r+uwD+Ogb0NhdnPv8/l0NSpormqgh jx9qU3TKSnSIgBELtTIyDdRziUT9qC4IwhdlDoqYz/7HioNlROnOO3TM+MUC/0pmM2mv MGKiEWFJMFrAUycb1I6ZnVjWv/MqbKHivDonKWooEG3+Qyv2cU6tRHJ/BVKeORCdZazK HzX01z3l7tAs94f61BndKzzPfA0lkMwnf725Of1opePmRsV9t8EqjRuaTXd2KRc4gxhg 3RWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NGcV2vyB; 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 z2si21922994ede.501.2020.12.28.18.44.26; Mon, 28 Dec 2020 18:44:48 -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=NGcV2vyB; 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 S2502834AbgL1OXh (ORCPT + 99 others); Mon, 28 Dec 2020 09:23:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:56246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502281AbgL1OVH (ORCPT ); Mon, 28 Dec 2020 09:21:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D1B33229C4; Mon, 28 Dec 2020 14:20:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165252; bh=2gy3TOScgNh8m+dTHpP9snc3RqWAPlNwVP1gpSbrAg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NGcV2vyBuG2USJGuFrOu7Vt/0M3eja81PVJQN6hDYv7MSKThH+CLoin5NhHU1q1Bz 9YGExFtuKKwY9kBJmLnXYZMmvmApB4JmDatJu+sbQ8ayz8Z0ljslt6gUwbDXoyRibb Iy0VjG4lim9958G86xQsj/GUfGsBreMOxmIar85c= 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 5.10 466/717] net: bcmgenet: Fix a resource leak in an error handling path in the probe functin Date: Mon, 28 Dec 2020 13:47:44 +0100 Message-Id: <20201228125043.297617662@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 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 be85dad2e3bc4..fcca023f22e54 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -4069,8 +4069,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