Skip to content

Commit

Permalink
net: propagate dev_get_valid_name return code
Browse files Browse the repository at this point in the history
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: Li RongQing <lirongqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
lrq-max authored and davem330 committed Jun 19, 2018
1 parent 56f7722 commit 7892bd0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -8643,7 +8643,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 */
if (!pat)
goto out;
if (dev_get_valid_name(net, dev, pat) < 0)
err = dev_get_valid_name(net, dev, pat);
if (err < 0)
goto out;
}

Expand All @@ -8655,7 +8656,6 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
dev_close(dev);

/* And unlink it from device chain */
err = -ENODEV;
unlist_netdevice(dev);

synchronize_net();
Expand Down

0 comments on commit 7892bd0

Please sign in to comment.