mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
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
1 changed files with 5 additions and 1 deletions
|
@ -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 a new issue