]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: handle errors from device_rename
authorStephen Hemminger <shemminger@vyatta.com>
Thu, 15 May 2008 05:33:38 +0000 (22:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 15 May 2008 05:33:38 +0000 (22:33 -0700)
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>
net/core/dev.c

index a1607bc0cd4cd3601b2183616845b564a1057c52..ce88c0d3e35470d1c052a0ed8b92d2dbd4a7f5f3 100644 (file)
@@ -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);