[NET] dev_change_name: ignore changes to same name
authorStephen Hemminger <shemminger@linux-foundation.org>
Fri, 26 Oct 2007 10:53:42 +0000 (03:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Oct 2007 10:53:42 +0000 (03:53 -0700)
Prevent error/backtrace from dev_rename() when changing
name of network device to the same name. This is a common
situation with udev and other scripts that bind addr to device.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c

index f1647d7dd14bdf8f730522d5a251636e392a3a6d..ddfef3b45babd9486b00752c696c3b96addb653d 100644 (file)
@@ -883,6 +883,9 @@ int dev_change_name(struct net_device *dev, char *newname)
        if (!dev_valid_name(newname))
                return -EINVAL;
 
+       if (strncmp(newname, dev->name, IFNAMSIZ) == 0)
+               return 0;
+
        memcpy(oldname, dev->name, IFNAMSIZ);
 
        if (strchr(newname, '%')) {