diff options
author | Nicolas Dichtel <nicolas.dichtel@6wind.com> | 2015-01-20 09:15:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-23 20:51:14 -0500 |
commit | bdef279b993b3a112c493447d5b3d8f28c229d88 (patch) | |
tree | 52d3509eb43202c94e050351dcea588054e5c16d /net/core | |
parent | d7924450e14ea414568563ec01489f77452b00b4 (diff) |
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: 317f4810e45e ("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>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/rtnetlink.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index a12eecc0f976..07447d1665e6 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -2172,8 +2172,11 @@ replay: | |||
2172 | goto out; | 2172 | goto out; |
2173 | } | 2173 | } |
2174 | 2174 | ||
2175 | if (link_net) | 2175 | if (link_net) { |
2176 | err = dev_change_net_namespace(dev, dest_net, ifname); | 2176 | err = dev_change_net_namespace(dev, dest_net, ifname); |
2177 | if (err < 0) | ||
2178 | unregister_netdevice(dev); | ||
2179 | } | ||
2177 | out: | 2180 | out: |
2178 | if (link_net) | 2181 | if (link_net) |
2179 | put_net(link_net); | 2182 | put_net(link_net); |