net: handle errors from device_rename
device_rename can fail with -EEXIST or -ENOMEM, so handle any problems. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8f40f672e6
commit
dcc997738e
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user