Skip to content

Commit c8d90dc

Browse files
Stephen Hemmingerdavem330
authored andcommitted
[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: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8c56a34 commit c8d90dc

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎net/core/dev.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,9 @@ int dev_change_name(struct net_device *dev, char *newname)
883883
if (!dev_valid_name(newname))
884884
return -EINVAL;
885885

886+
if (strncmp(newname, dev->name, IFNAMSIZ) == 0)
887+
return 0;
888+
886889
memcpy(oldname, dev->name, IFNAMSIZ);
887890

888891
if (strchr(newname, '%')) {

0 commit comments

Comments
 (0)