Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2290585pxb; Mon, 11 Jan 2021 06:10:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJylBPVuXK6VIl1T4GKjX7oBhaQ3T6qHJMAaHua0z+mnYtrkfJkeCB57M7IeI+KYoZGnbRux X-Received: by 2002:a17:906:1955:: with SMTP id b21mr11032006eje.236.1610374252366; Mon, 11 Jan 2021 06:10:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610374252; cv=none; d=google.com; s=arc-20160816; b=BgHVGYRiRkjGtNJ4LS9t3MBoYHBFYMLTpIEUGEeflWOlpPOTA5z+tdHId3WwUW7XlB XrlRNgpm1pF/pa0LvYhpqDQKgYf0GsJcolAo1eyA8bjEBwvEhAABoz5lBf0P4JjmmYMm pna78uYEkzSKiiWSyg65L/8K8oOl1RYeI3xKlf6gJNWMsk3Pva+CrHnj+RBB4QKHqT8o jnNPSBPeghf9vqSFXIDJheelU+sMvomVopDn6JbeRUe/2/rahyDmTgLmh6Zb4VGZYn16 a4DYY8KGvbbNouXp3/yNJOf+qT1job2DTa9g8EnsYXEiEX1XZ8uzI54RmjFyANRPLvVd dmOQ== 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=K98GvuUdEhxq8ru45q+vGozqfRw6a69FTNOUzJN64dI=; b=cRkz69rHTXC0OboM71N7DfFWjOsoalo6RbtYp/xa8lgNHn1FICNDLaPDIZNw3/8b88 wzP5Q5ZssP7QYRWfiAZuYLp5jeEn0cRjewA0K+YLgzorZj8RxFvqlywAwD5Uf806w7Iy Kvk5QtH3YQoMA/FYlXzccZYerc9q4MR3cgTfW1s4WkTfud8nWEM/DpnxoJvGpGVEcy9q vFAtr5nXE+Yi/dnToCsvvTcig2Sd6lqZOfwxXhVIzJyvJ4HYG1Hom1y1VSQTga54HRVt tABxVi6FkdW8hK8032BfSrzGwhNWRMkyl29MTPJhum15dscBbCqcryjYxKbnjq23PUlq Wm3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zgbsVxg+; 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 jp19si6307772ejb.465.2021.01.11.06.10.27; Mon, 11 Jan 2021 06:10:52 -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=zgbsVxg+; 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 S2388069AbhAKOIJ (ORCPT + 99 others); Mon, 11 Jan 2021 09:08:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:50166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729929AbhAKNDk (ORCPT ); Mon, 11 Jan 2021 08:03:40 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 533C92255F; Mon, 11 Jan 2021 13:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370198; bh=b4yuLKpv+ebbb3PZ4TAwPUSOD5PZvUNwBTInetKZJOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zgbsVxg+dIUWAxunfdH8/xv5zUqnte8kiqxkkPIUgrg3qSGv232oq+0FF+NTX2kpJ kCXz1SlfsASCQchzufJQfFnFJ9TtZ4IxPKdKMspgoCXgCzJw9N/vwJf5EuWE2AGTjg Ru14+FBK8ApzTvnzr+0m3rMqYpkqC/hRCNB3BG7g= 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.9 09/45] net: ethernet: Fix memleak in ethoc_probe Date: Mon, 11 Jan 2021 14:00:47 +0100 Message-Id: <20210111130034.116685187@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130033.676306636@linuxfoundation.org> References: <20210111130033.676306636@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 @@ -1190,7 +1190,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); @@ -1222,6 +1222,7 @@ error2: netif_napi_del(&priv->napi); error: mdiobus_unregister(priv->mdio); +free3: mdiobus_free(priv->mdio); free2: if (priv->clk)