summaryrefslogtreecommitdiff
path: root/drivers/net/hamradio
diff options
context:
space:
mode:
authorWang Hai <wanghai38@huawei.com>2020-06-04 20:18:51 +0800
committerSasha Levin <sashal@kernel.org>2020-06-29 20:07:49 -0400
commit9f34721c28ebf58389e5fb138a7f11e6a4144977 (patch)
treecaf1f79918ff4825ebad1a971649c9d3c8b18165 /drivers/net/hamradio
parent94feb3b5641132f370aa71bde8ac70d35fd19b8e (diff)
yam: fix possible memory leak in yam_init_driver
[ Upstream commit 98749b7188affbf2900c2aab704a8853901d1139 ] If register_netdev(dev) fails, free_netdev(dev) needs to be called, otherwise a memory leak will occur. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wang Hai <wanghai38@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/hamradio')
-rw-r--r--drivers/net/hamradio/yam.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 1a4729c36aa4..623e4225e7c8 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -1160,6 +1160,7 @@ static int __init yam_init_driver(void)
err = register_netdev(dev);
if (err) {
printk(KERN_WARNING "yam: cannot register net device %s\n", dev->name);
+ free_netdev(dev);
goto error;
}
yam_devs[i] = dev;