mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
rtnl: fix error path when adding an iface with a link net
If an error occurs when the netdevice is moved to the link netns, a full cleanup
must be done.
Fixes: 317f4810e4
("rtnl: allow to create device with IFLA_LINK_NETNSID set")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d7924450e1
commit
bdef279b99
1 changed files with 4 additions and 1 deletions
|
@ -2172,8 +2172,11 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (link_net)
|
||||
if (link_net) {
|
||||
err = dev_change_net_namespace(dev, dest_net, ifname);
|
||||
if (err < 0)
|
||||
unregister_netdevice(dev);
|
||||
}
|
||||
out:
|
||||
if (link_net)
|
||||
put_net(link_net);
|
||||
|
|
Loading…
Reference in a new issue