From: Aditya Pakki <pakki001@umn.edu>
To: pakki001@umn.edu
Cc: kjlu@umn.edu, wu000273@umn.edu,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Enrico Weigelt <info@metux.net>,
Allison Randal <allison@lohutok.net>,
Thomas Gleixner <tglx@linutronix.de>,
"Michael S. Tsirkin" <mst@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] net: ethernet: Fix potential memory leak caused in error handling
Date: Fri, 12 Jun 2020 15:06:54 -0500 [thread overview]
Message-ID: <20200612200656.56019-1-pakki001@umn.edu> (raw)
In ethoc_probe, a failure of mdiobus_register() does not release
the memory allocated by mdiobus_alloc. The patch fixes this issue.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
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 a817ca661c1f..2f6bab9f1d71 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -1207,7 +1207,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 free_mdio;
}
ret = ethoc_mdio_probe(netdev);
@@ -1239,6 +1239,7 @@ static int ethoc_probe(struct platform_device *pdev)
netif_napi_del(&priv->napi);
error:
mdiobus_unregister(priv->mdio);
+free_mdio:
mdiobus_free(priv->mdio);
free2:
clk_disable_unprepare(priv->clk);
--
2.25.1
next reply other threads:[~2020-06-12 20:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-12 20:06 Aditya Pakki [this message]
2020-06-12 20:46 ` Andrew Lunn
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=20200612200656.56019-1-pakki001@umn.edu \
--to=pakki001@umn.edu \
--cc=allison@lohutok.net \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=info@metux.net \
--cc=kjlu@umn.edu \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=wu000273@umn.edu \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®