提交 40102371 编写于 作者: K Kim B. Heino 提交者: David S. Miller

[TUN]: Fix RTNL-locking in tun/tap driver

Current tun/tap driver sets also net device's hw address when asked to
change character device's hw address. This is a good idea, but it
misses RTLN-locking, resulting following error message in 2.6.25-rc3's
inetdev_event() function:

RTNL: assertion failed at net/ipv4/devinet.c (1050)

Attached patch fixes this problem.
Signed-off-by: NKim B. Heino <Kim.Heino@bluegiga.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 459eea74
......@@ -663,7 +663,11 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
case SIOCSIFHWADDR:
{
/* try to set the actual net device's hw address */
int ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr);
int ret;
rtnl_lock();
ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr);
rtnl_unlock();
if (ret == 0) {
/** Set the character device's hardware address. This is used when
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册