]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
devinet: fix memleak in inetdev_init()
authorYang Yingliang <yangyingliang@huawei.com>
Sat, 30 May 2020 03:34:33 +0000 (11:34 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 31 May 2020 00:48:56 +0000 (17:48 -0700)
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>
net/ipv4/devinet.c

index c0dd561aa19032f8b6637d9b387e4fa404b31828..5267b6b191ebaa540b0012d468fd995d3c79cd8f 100644 (file)
@@ -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;