]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[TUN]: Fix RTNL-locking in tun/tap driver
authorKim B. Heino <Kim.Heino@bluegiga.com>
Fri, 29 Feb 2008 20:26:21 +0000 (12:26 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Feb 2008 20:26:21 +0000 (12:26 -0800)
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>
drivers/net/tun.c

index 038c1ef94d2e72e7332a4e28a86cbd82be14788a..7b816a032957b61d692b897c33517bc3f7ad81a3 100644 (file)
@@ -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