Commit c8d90dca authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[NET] dev_change_name: ignore changes to same name

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: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8c56a347
...@@ -883,6 +883,9 @@ int dev_change_name(struct net_device *dev, char *newname) ...@@ -883,6 +883,9 @@ int dev_change_name(struct net_device *dev, char *newname)
if (!dev_valid_name(newname)) if (!dev_valid_name(newname))
return -EINVAL; return -EINVAL;
if (strncmp(newname, dev->name, IFNAMSIZ) == 0)
return 0;
memcpy(oldname, dev->name, IFNAMSIZ); memcpy(oldname, dev->name, IFNAMSIZ);
if (strchr(newname, '%')) { if (strchr(newname, '%')) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment