Commit b73fdeae authored by Stephen Hemminger's avatar Stephen Hemminger

[NET]: Network device renaming sysfs fix.

parent 6d62388c
...@@ -2343,14 +2343,18 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd) ...@@ -2343,14 +2343,18 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
case SIOCSIFNAME: case SIOCSIFNAME:
if (dev->flags & IFF_UP) if (dev->flags & IFF_UP)
return -EBUSY; return -EBUSY;
ifr->ifr_newname[IFNAMSIZ-1] = '\0';
if (__dev_get_by_name(ifr->ifr_newname)) if (__dev_get_by_name(ifr->ifr_newname))
return -EEXIST; return -EEXIST;
memcpy(dev->name, ifr->ifr_newname, IFNAMSIZ); err = class_device_rename(&dev->class_dev,
dev->name[IFNAMSIZ - 1] = 0; ifr->ifr_newname);
strlcpy(dev->class_dev.class_id, dev->name, BUS_ID_SIZE); if (!err) {
notifier_call_chain(&netdev_chain, strlcpy(dev->name, ifr->ifr_newname, IFNAMSIZ);
NETDEV_CHANGENAME, dev);
return 0; notifier_call_chain(&netdev_chain,
NETDEV_CHANGENAME, dev);
}
return err;
/* /*
* Unknown or private ioctl * Unknown or private ioctl
......
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