Commit 1ba6fc7b authored by Li RongQing's avatar Li RongQing Committed by Kleber Sacilotto de Souza

net: propagate dev_get_valid_name return code

BugLink: https://bugs.launchpad.net/bugs/1792377

[ Upstream commit 7892bd08 ]

if dev_get_valid_name failed, propagate its return code

and remove the setting err to ENODEV, it will be set to
0 again before dev_change_net_namespace exits.
Signed-off-by: default avatarLi RongQing <lirongqing@baidu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent e01b46b5
...@@ -7422,7 +7422,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char ...@@ -7422,7 +7422,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
/* We get here if we can't use the current device name */ /* We get here if we can't use the current device name */
if (!pat) if (!pat)
goto out; goto out;
if (dev_get_valid_name(net, dev, pat) < 0) err = dev_get_valid_name(net, dev, pat);
if (err < 0)
goto out; goto out;
} }
...@@ -7434,7 +7435,6 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char ...@@ -7434,7 +7435,6 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
dev_close(dev); dev_close(dev);
/* And unlink it from device chain */ /* And unlink it from device chain */
err = -ENODEV;
unlist_netdevice(dev); unlist_netdevice(dev);
synchronize_net(); synchronize_net();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment