Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2674932pxb; Mon, 11 Jan 2021 16:51:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWLZ74jNpHs1+6VTqRMsE3NXFUVQWpNlyvvwzmTGXFsJczw98pE/QmxSJJ6lFA+s/GOwav X-Received: by 2002:aa7:d642:: with SMTP id v2mr1406821edr.305.1610412706270; Mon, 11 Jan 2021 16:51:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610412706; cv=none; d=google.com; s=arc-20160816; b=tApxE42RfTokQxoZsWjuJ6+pJoMN+XbexRrJzUXNQNLnWFdrHUrUYwmVz69ly3Hcfo c8Ozq8xLGhvb8vfM9+lewuB3niMxZjtelxECiqOrsnMuIh9VD8oY15OQNMCRWu+iBX1c H9PmZCjCHn8Em2npwdLADXzRkAwnY44AiDuOzGC8l8PKdh2SVRf7o/NYdN3MIZLYsOj3 vUI+uE3w4M3fPt7kQb6FyV00TpQ0qoJZHONYpKmV20nramFJMANP11VrbrBQyjegH9Ns Oxg9gK0THtawvtJnAcCuqNPLfO5rvsmjvaOANnXSqBa5e3OdBFnjldjZIH2YRd0ki9X0 gbMQ== 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=bjlJoO8v3BSmIi8K3OkutoCYuVyCDRwcshOqkpmpWaQ=; b=xGQuVkYO5qbseMkC2LZIOWtaI3GTP0PIPoZ0WGP1hKEf2VhAGBLNiuCoqUrZ17/6vg iTsmryvmbqP3SiYO8RU0VWehzWBzwTrYDW+NdgFjfyBP03m9UG/dxOBu3DFiorGPnL/E 8CHGBR/l+AQS6QeTMGheqd1IKeHE6QSXASuiAtla7OB1OtQxuAxjtPP0AzGegA31H/K1 VimvWq+FuZOrwFExASXpxGjPS8XRnVJdIbidN+HBOV5VFTcUSfVpkWJjsExiVNHFkOlS FSCJCd2yN3vg9lLUOJP982JhTtXGBg+6uL605IDjQG4ffrNBJr+LcbZX6ATqHhb6cLY3 Uhzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vHPQ+FVD; 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 h21si551677edq.302.2021.01.11.16.51.22; Mon, 11 Jan 2021 16:51:46 -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=vHPQ+FVD; 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 S1727986AbhAKNJN (ORCPT + 99 others); Mon, 11 Jan 2021 08:09:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:55384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730660AbhAKNIA (ORCPT ); Mon, 11 Jan 2021 08:08:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5A03C22AAB; Mon, 11 Jan 2021 13:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370439; bh=cXnM1g8SFlXDkxWAYwX+ExXwXR8yZr9EMAwmNoIqXcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vHPQ+FVDaoeeASvdLp+/9uwjzn94I3PTZJcqzYfZl/5yu6C1HdxbeT5OAwx65ZSyo ee1lUmF4rcH3ajlKoJGYQl9HrF+wwOInzTfGk8dPREd7bhu3sOd1fYgYq8pK6N/Fri m2XTPH6b21Ho5uhXFdbPbiLuDkww+KAFYxxEi2Yk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Andrew Lunn , Jakub Kicinski Subject: [PATCH 4.19 22/77] net: ethernet: Fix memleak in ethoc_probe Date: Mon, 11 Jan 2021 14:01:31 +0100 Message-Id: <20210111130037.485000719@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130036.414620026@linuxfoundation.org> References: <20210111130036.414620026@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: Dinghao Liu [ Upstream commit 5d41f9b7ee7a5a5138894f58846a4ffed601498a ] When mdiobus_register() fails, priv->mdio allocated by mdiobus_alloc() has not been freed, which leads to memleak. Fixes: e7f4dc3536a4 ("mdio: Move allocation of interrupts into core") Signed-off-by: Dinghao Liu Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20201223110615.31389-1-dinghao.liu@zju.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/ethoc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/ethoc.c +++ b/drivers/net/ethernet/ethoc.c @@ -1213,7 +1213,7 @@ static int ethoc_probe(struct platform_d ret = mdiobus_register(priv->mdio); if (ret) { dev_err(&netdev->dev, "failed to register MDIO bus\n"); - goto free2; + goto free3; } ret = ethoc_mdio_probe(netdev); @@ -1245,6 +1245,7 @@ error2: netif_napi_del(&priv->napi); error: mdiobus_unregister(priv->mdio); +free3: mdiobus_free(priv->mdio); free2: clk_disable_unprepare(priv->clk);