Patchwork wd: fix memory leak

login
register
mail settings
Submitter Kulikov Vasiliy
Date July 13, 2010, 11:23 a.m.
Message ID <1279020192-9484-1-git-send-email-segooon@gmail.com>
Download mbox | patch
Permalink /patch/58767/
State Accepted
Delegated to: David Miller
Headers show

Comments

Kulikov Vasiliy - July 13, 2010, 11:23 a.m.
Unmap mapped IO in wd_probe1() if register_netdev() failed.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/net/wd.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
David Miller - July 15, 2010, 12:53 a.m.
From: Kulikov Vasiliy <segooon@gmail.com>
Date: Tue, 13 Jul 2010 15:23:12 +0400

> Unmap mapped IO in wd_probe1() if register_netdev() failed.
> 
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/wd.c b/drivers/net/wd.c
index 746a5ee..eb72c67 100644
--- a/drivers/net/wd.c
+++ b/drivers/net/wd.c
@@ -358,8 +358,10 @@  static int __init wd_probe1(struct net_device *dev, int ioaddr)
 #endif
 
 	err = register_netdev(dev);
-	if (err)
+	if (err) {
 		free_irq(dev->irq, dev);
+		iounmap(ei_status.mem);
+	}
 	return err;
 }