Commit b068fc92 authored by Dan Aloni's avatar Dan Aloni Committed by Linus Torvalds

[PATCH] avoid Oops in net/core/dev.c

This fixes the kernel crash in the case when we do an SIOCSIFNAME
ioctl on /proc/net/dev to rename a network interface, and
we supply a string such as "foo%sbar".
parent 49b1b087
...@@ -2346,7 +2346,7 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd) ...@@ -2346,7 +2346,7 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
return -EEXIST; return -EEXIST;
memcpy(dev->name, ifr->ifr_newname, IFNAMSIZ); memcpy(dev->name, ifr->ifr_newname, IFNAMSIZ);
dev->name[IFNAMSIZ - 1] = 0; dev->name[IFNAMSIZ - 1] = 0;
snprintf(dev->class_dev.class_id, BUS_ID_SIZE, dev->name); strlcpy(dev->class_dev.class_id, dev->name, BUS_ID_SIZE);
notifier_call_chain(&netdev_chain, notifier_call_chain(&netdev_chain,
NETDEV_CHANGENAME, dev); NETDEV_CHANGENAME, dev);
return 0; return 0;
......
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