* [PATCH] net/ne: fix memory leak in ne_drv_probe()
@ 2010-07-03 15:20 Kulikov Vasiliy
2010-07-06 3:08 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Kulikov Vasiliy @ 2010-07-03 15:20 UTC (permalink / raw)
To: Kernel Janitors
Cc: David S. Miller, Joe Perches, Atsushi Nemoto, netdev,
linux-kernel
net_device allocated with alloc_eip_netdev() must be freed.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
drivers/net/ne.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index b8e2923..1063093 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -796,28 +796,30 @@ static int __init ne_drv_probe(struct platform_device *pdev)
dev = alloc_eip_netdev();
if (!dev)
return -ENOMEM;
/* ne.c doesn't populate resources in platform_device, but
* rbtx4927_ne_init and rbtx4938_ne_init do register devices
* with resources.
*/
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
if (res) {
dev->base_addr = res->start;
dev->irq = platform_get_irq(pdev, 0);
} else {
- if (this_dev < 0 || this_dev >= MAX_NE_CARDS)
+ if (this_dev < 0 || this_dev >= MAX_NE_CARDS) {
+ free_netdev(dev);
return -EINVAL;
+ }
dev->base_addr = io[this_dev];
dev->irq = irq[this_dev];
dev->mem_end = bad[this_dev];
}
err = do_ne_probe(dev);
if (err) {
free_netdev(dev);
return err;
}
platform_set_drvdata(pdev, dev);
/* Update with any values found by probing, don't update if
* resources were specified.
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-06 3:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-03 15:20 [PATCH] net/ne: fix memory leak in ne_drv_probe() Kulikov Vasiliy
2010-07-06 3:08 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).