summaryrefslogtreecommitdiff
path: root/net/ipv4/devinet.c
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2020-05-30 06:34:33 +0300
committerDavid S. Miller <davem@davemloft.net>2020-05-31 03:48:56 +0300
commit1b49cd71b52403822731dc9f283185d1da355f97 (patch)
tree2e349d434e2b0b69373d78d35518acedcf7985d7 /net/ipv4/devinet.c
parent8692cefc433f282228fd44938dd4d26ed38254a2 (diff)
downloadlinux-1b49cd71b52403822731dc9f283185d1da355f97.tar.xz
devinet: fix memleak in inetdev_init()
When devinet_sysctl_register() failed, the memory allocated in neigh_parms_alloc() should be freed. Fixes: 20e61da7ffcf ("ipv4: fail early when creating netdev named all or default") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Acked-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r--net/ipv4/devinet.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index c0dd561aa190..5267b6b191eb 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -276,6 +276,7 @@ static struct in_device *inetdev_init(struct net_device *dev)
err = devinet_sysctl_register(in_dev);
if (err) {
in_dev->dead = 1;
+ neigh_parms_release(&arp_tbl, in_dev->arp_parms);
in_dev_put(in_dev);
in_dev = NULL;
goto out;