Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2273766pxb; Mon, 11 Jan 2021 05:46:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbK6sOyExX4A4ES2WeZswSzQ/Xs0a7U3k9l32BgPrFwOEbt0lXE+Wran9e2wMOtTJo7rxD X-Received: by 2002:a17:906:378f:: with SMTP id n15mr10680070ejc.263.1610372796535; Mon, 11 Jan 2021 05:46:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610372796; cv=none; d=google.com; s=arc-20160816; b=ohmC7z5BryoQ004eOMeRFLeya+oA4Gi62/AKUp740ybVbvJ7EQ515DLKflyF1rZMIv iyoLxh3XRVcYOOq1eICL123vEktQXjQulSsh5OW+ExXqu5fjUoFU+RkKRdlf6bfuIxVP 8nyT11t5b5FB+avUzS/S1AeW8ko8Sdoh13R3g16sQR4o5v3WpBqvWiB5Ii6tv7qmB1uj 6xbWB41LUYqIuHVnN/QYDWD+llaes6Iav58AlspEKzQ4YAyUXY6GI+EOY1HL6ayoQhIJ xtC7adoci8hIKXfr23QeAjyjJ5lIVd+/RbYA/cWmLsNmR86+qmm4N+M0bI5QVEB7We0j JbfA== 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=bVETq1tBLaF8Y4RjV4PWAIvfWJ7CXwuIji7mbeRS8VE=; b=jhZGjv43sgA9GQgz/b3C3iZC80xHwxpk4UZXG3gdQTxoGWrDjIrFLVQBls44CuH6hX i4aDWPNhPKqnW/DB3++vi9L67CYxwVLReA7FE6evj0WWrmDfXVRigDeUuZtJ1pWyW1I2 /MIwpf5zD/kiPeI+7orEI/SOiAzEGMV37lpghVHnDhQfyp+9MhrXPdfiQi3kJxGvsiUe ndcHYfJp30tBK4XBqKMLepNC/8/So/UCl8OUPNQmqfOp1JFz82s5FraKtWFaUvFjOJqo AqcsW3WjPK+nrLeyWUyRu14zF0eah5gUeOHYWFD/tfuPSLHzBVZ2neNlBIQFPR1YEpiY tRdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fV5ceLXK; 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 q14si6442699ejx.155.2021.01.11.05.46.12; Mon, 11 Jan 2021 05:46:36 -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=fV5ceLXK; 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 S1730807AbhAKNMB (ORCPT + 99 others); Mon, 11 Jan 2021 08:12:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:58192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731316AbhAKNLD (ORCPT ); Mon, 11 Jan 2021 08:11:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DBEEC22795; Mon, 11 Jan 2021 13:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370622; bh=FUy1xwRMw7YqWPft1kH5bPHMQ2sY+SKXfSX4oqJwuJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fV5ceLXKdALJxp7cFlA9eOd9uylqQUIPdMBsMAO673UMfJV1SYm/NDXOZXEiQN165 oDMCXIeeEFOM3TAqHJp79fkoJHb0BYK7goy86UyIqHR4Pz4Emsawr0GJ+jHtwUlEj+ EU/4bmwKR6FwwnNLQ+MW1ZzNaDKC+tZklkdjP+mY= 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 5.4 25/92] net: ethernet: Fix memleak in ethoc_probe Date: Mon, 11 Jan 2021 14:01:29 +0100 Message-Id: <20210111130040.359268434@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130039.165470698@linuxfoundation.org> References: <20210111130039.165470698@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 @@ -1207,7 +1207,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); @@ -1239,6 +1239,7 @@ error2: netif_napi_del(&priv->napi); error: mdiobus_unregister(priv->mdio); +free3: mdiobus_free(priv->mdio); free2: clk_disable_unprepare(priv->clk);