From: Dinghao Liu <dinghao.liu@zju.edu.cn> To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Jesse Brandeburg <jesse.brandeburg@intel.com>, Arnd Bergmann <arnd@arndb.de>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: ethernet: Fix memleak in ethoc_probe Date: Wed, 23 Dec 2020 19:06:12 +0800 Message-ID: <20201223110615.31389-1-dinghao.liu@zju.edu.cn> (raw) When mdiobus_register() fails, priv->mdio allocated by mdiobus_alloc() has not been freed, which leads to memleak. Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> --- drivers/net/ethernet/ethoc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c index 0981fe9652e5..3d9b0b161e24 100644 --- a/drivers/net/ethernet/ethoc.c +++ b/drivers/net/ethernet/ethoc.c @@ -1211,7 +1211,7 @@ static int ethoc_probe(struct platform_device *pdev) 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); @@ -1243,6 +1243,7 @@ static int ethoc_probe(struct platform_device *pdev) netif_napi_del(&priv->napi); error: mdiobus_unregister(priv->mdio); +free3: mdiobus_free(priv->mdio); free2: clk_disable_unprepare(priv->clk); -- 2.17.1
next reply index Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-23 11:06 Dinghao Liu [this message] 2020-12-23 15:33 ` Andrew Lunn 2020-12-23 20:32 ` Jakub Kicinski 2020-12-23 21:00 ` Andrew Lunn 2020-12-23 21:11 ` Jakub Kicinski 2020-12-23 22:17 ` Florian Fainelli 2020-12-24 1:41 ` Jakub Kicinski 2020-12-24 18:06 ` Konstantin Ryabitsev 2020-12-24 21:57 ` Florian Fainelli 2020-12-28 20:23 ` Konstantin Ryabitsev 2020-12-28 21:05 ` Florian Fainelli 2020-12-28 21:14 ` Konstantin Ryabitsev 2020-12-30 21:36 ` Jakub Kicinski 2021-01-06 10:56 ` dinghao.liu 2021-01-06 16:44 ` Jakub Kicinski 2021-01-07 7:54 ` dinghao.liu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201223110615.31389-1-dinghao.liu@zju.edu.cn \ --to=dinghao.liu@zju.edu.cn \ --cc=arnd@arndb.de \ --cc=davem@davemloft.net \ --cc=jesse.brandeburg@intel.com \ --cc=kjlu@umn.edu \ --cc=kuba@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=netdev@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ linux-kernel@vger.kernel.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git