diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2019-12-03 17:12:39 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-12-03 11:19:29 -0800 |
commit | 42c17fa69f9866a3f80ac196ce70b4fda1242717 (patch) | |
tree | 9d622ebc4023504e95cabcb249bcdac3771ddf7b /net/core/dev.c | |
parent | 56e7a2f83d13306500ce807dd7ebbbb73b5a91d6 (diff) | |
download | linux-stable-42c17fa69f9866a3f80ac196ce70b4fda1242717.tar.gz linux-stable-42c17fa69f9866a3f80ac196ce70b4fda1242717.tar.bz2 linux-stable-42c17fa69f9866a3f80ac196ce70b4fda1242717.zip |
net: fix a leak in register_netdevice()
We have to free "dev->name_node" on this error path.
Fixes: ff92741270bf ("net: introduce name_node struct to be used in hashlist")
Reported-by: syzbot+6e13e65ffbaa33757bcb@syzkaller.appspotmail.com
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 46580b290450..e7c027fb4808 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9246,7 +9246,7 @@ int register_netdevice(struct net_device *dev) if (ret) { if (ret > 0) ret = -EIO; - goto out; + goto err_free_name; } } @@ -9361,12 +9361,12 @@ out: return ret; err_uninit: - if (dev->name_node) - netdev_name_node_free(dev->name_node); if (dev->netdev_ops->ndo_uninit) dev->netdev_ops->ndo_uninit(dev); if (dev->priv_destructor) dev->priv_destructor(dev); +err_free_name: + netdev_name_node_free(dev->name_node); goto out; } EXPORT_SYMBOL(register_netdevice); |