aboutsummaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-05-14 22:33:38 -0700
committerDavid S. Miller <davem@davemloft.net>2008-05-14 22:33:38 -0700
commitdcc997738e538919101d8756f19ca23110b25d8d (patch)
treed0d190f28c94115c61afae0081248ceee51fd457 /net/core
parent8f40f672e6bb071812f61bfbd30efc3fc1263ad1 (diff)
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>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index a1607bc0cd4..ce88c0d3e35 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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);