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

net: handle errors from device_rename

device_rename can fail with -EEXIST or -ENOMEM, so handle any
problems.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8f40f672
......@@ -903,7 +903,11 @@ int dev_change_name(struct net_device *dev, char *newname)
strlcpy(dev->name, newname, IFNAMSIZ);
rollback:
device_rename(&dev->dev, dev->name);
err = device_rename(&dev->dev, dev->name);
if (err) {
memcpy(dev->name, oldname, IFNAMSIZ);
return err;
}
write_lock_bh(&dev_base_lock);
hlist_del(&dev->name_hlist);
......
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