summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWang Hai <wanghai38@huawei.com>2020-06-04 14:18:51 +0200
committerDavid S. Miller <davem@davemloft.net>2020-06-05 00:58:41 +0200
commit98749b7188affbf2900c2aab704a8853901d1139 (patch)
treee474af8cf3c514c0c1817907b6b10938e81e517b /drivers
parentlan743x: Use correct MAC_CR configuration for 1 GBit speed (diff)
downloadlinux-98749b7188affbf2900c2aab704a8853901d1139.tar.xz
linux-98749b7188affbf2900c2aab704a8853901d1139.zip
yam: fix possible memory leak in yam_init_driver
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>
Diffstat (limited to '')
-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 71cdef9fb56b..5ab53e9942f3 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -1133,6 +1133,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;