Skip to content

Commit

Permalink
netdev: change name dropping error codes
Browse files Browse the repository at this point in the history
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: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Oct 20, 2008
1 parent 0537ae6 commit 92845ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,10 +924,10 @@ int dev_change_name(struct net_device *dev, const char *newname)
strlcpy(dev->name, newname, IFNAMSIZ);

rollback:
err = device_rename(&dev->dev, dev->name);
if (err) {
ret = device_rename(&dev->dev, dev->name);
if (ret) {
memcpy(dev->name, oldname, IFNAMSIZ);
return err;
return ret;
}

write_lock_bh(&dev_base_lock);
Expand Down

0 comments on commit 92845ff

Please sign in to comment.