All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: Fix potential memory leak caused in error handling
@ 2020-06-12 20:06 Aditya Pakki
  2020-06-12 20:46 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2020-06-12 20:06 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, wu000273, David S. Miller, Jakub Kicinski, Arnd Bergmann,
	Enrico Weigelt, Allison Randal, Thomas Gleixner,
	Michael S. Tsirkin, netdev, linux-kernel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: ethernet: Fix potential memory leak caused in error handling
  2020-06-12 20:06 [PATCH] net: ethernet: Fix potential memory leak caused in error handling Aditya Pakki
@ 2020-06-12 20:46 ` Andrew Lunn
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2020-06-12 20:46 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: kjlu, wu000273, David S. Miller, Jakub Kicinski, Arnd Bergmann,
	Enrico Weigelt, Allison Randal, Thomas Gleixner,
	Michael S. Tsirkin, netdev, linux-kernel

On Fri, Jun 12, 2020 at 03:06:54PM -0500, Aditya Pakki wrote:
> In ethoc_probe, a failure of mdiobus_register() does not release
> the memory allocated by mdiobus_alloc. The patch fixes this issue.

Hi Aditya

Please improve the Subject: line to indicate which driver you are
fixing.

A Fixes: tag would also be nice.

  Andrew

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-12 20:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12 20:06 [PATCH] net: ethernet: Fix potential memory leak caused in error handling Aditya Pakki
2020-06-12 20:46 ` Andrew Lunn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.