Skip to content

Commit

Permalink
[TUN]: Fix RTNL-locking in tun/tap driver
Browse files Browse the repository at this point in the history
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: Kim B. Heino <Kim.Heino@bluegiga.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Kim B. Heino authored and David S. Miller committed Feb 29, 2008
1 parent 459eea7 commit 4010237
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4010237

Please sign in to comment.