Commit 92845ffd authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

netdev: change name dropping error codes

If changename notifier returns an error code, it gets incorrectly
cleared during rollback so the error is never returned to the user.
Found while testing similar code for MTU changes.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0537ae6a
...@@ -924,10 +924,10 @@ int dev_change_name(struct net_device *dev, const char *newname) ...@@ -924,10 +924,10 @@ int dev_change_name(struct net_device *dev, const char *newname)
strlcpy(dev->name, newname, IFNAMSIZ); strlcpy(dev->name, newname, IFNAMSIZ);
rollback: rollback:
err = device_rename(&dev->dev, dev->name); ret = device_rename(&dev->dev, dev->name);
if (err) { if (ret) {
memcpy(dev->name, oldname, IFNAMSIZ); memcpy(dev->name, oldname, IFNAMSIZ);
return err; return ret;
} }
write_lock_bh(&dev_base_lock); write_lock_bh(&dev_base_lock);
......
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