提交 55a5ec9b 编写于 作者: D David S. Miller

Revert "net: core: dev_get_valid_name is now the same as dev_alloc_name_ns"

This reverts commit 87c320e5.

Changing the error return code in some situations turns out to
be harmful in practice.  In particular Michael Ellerman reports
that DHCP fails on his powerpc machines, and this revert gets
things working again.

Johannes Berg agrees that this revert is the best course of
action for now.

Fixes: 029b6d14 ("Revert "net: core: maybe return -EEXIST in __dev_alloc_name"")
Reported-by: NMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2758b3e3
...@@ -1146,7 +1146,19 @@ EXPORT_SYMBOL(dev_alloc_name); ...@@ -1146,7 +1146,19 @@ EXPORT_SYMBOL(dev_alloc_name);
int dev_get_valid_name(struct net *net, struct net_device *dev, int dev_get_valid_name(struct net *net, struct net_device *dev,
const char *name) const char *name)
{ {
return dev_alloc_name_ns(net, dev, name); BUG_ON(!net);
if (!dev_valid_name(name))
return -EINVAL;
if (strchr(name, '%'))
return dev_alloc_name_ns(net, dev, name);
else if (__dev_get_by_name(net, name))
return -EEXIST;
else if (dev->name != name)
strlcpy(dev->name, name, IFNAMSIZ);
return 0;
} }
EXPORT_SYMBOL(dev_get_valid_name); EXPORT_SYMBOL(dev_get_valid_name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册