mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 17:41:44 +00:00
net: fix a leak in register_netdevice()
We have to free "dev->name_node" on this error path.
Fixes: ff92741270
("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>
This commit is contained in:
parent
56e7a2f83d
commit
42c17fa69f
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user