提交 dcc99773 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

net: handle errors from device_rename

device_rename can fail with -EEXIST or -ENOMEM, so handle any
problems.
Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8f40f672
......@@ -903,7 +903,11 @@ int dev_change_name(struct net_device *dev, char *newname)
strlcpy(dev->name, newname, IFNAMSIZ);
rollback:
device_rename(&dev->dev, dev->name);
err = device_rename(&dev->dev, dev->name);
if (err) {
memcpy(dev->name, oldname, IFNAMSIZ);
return err;
}
write_lock_bh(&dev_base_lock);
hlist_del(&dev->name_hlist);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册