From: Stephen Hemminger Date: Thu, 15 May 2008 05:33:38 +0000 (-0700) Subject: net: handle errors from device_rename X-Git-Tag: v2.6.26-rc4~91^2~21 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=dcc997738e538919101d8756f19ca23110b25d8d;p=linux-2.6-omap-h63xx.git net: handle errors from device_rename device_rename can fail with -EEXIST or -ENOMEM, so handle any problems. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- 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);