summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2020-05-30 06:34:33 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-10 21:24:54 +0300
commit449c723240851300681282b50c28920dbee346eb (patch)
tree974d1cc6bbbc76b430e2effab6ad81726acc2cb4
parent3604bc07c035939266d78d65084c6cd54ffc6d56 (diff)
downloadlinux-449c723240851300681282b50c28920dbee346eb.tar.xz
devinet: fix memleak in inetdev_init()
[ Upstream commit 1b49cd71b52403822731dc9f283185d1da355f97 ] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 458dc6eb5a68..a27d034c85cc 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;