login
Header Space

 
 

[PATCH] fix RTNL-locking in tun/tap driver

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <maxk@...>
Cc: <linux-kernel@...>
Date: Wednesday, February 27, 2008 - 5:38 am

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>


--- linux-2.6.25-rc3/drivers/net/tun.c.foo	2008-02-27 10:06:28.000000000 +0200
+++ linux-2.6.25-rc3/drivers/net/tun.c	2008-02-27 10:06:40.000000000 +0200
@@ -663,7 +663,11 @@ static int tun_chr_ioctl(struct inode *i
 	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
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] fix RTNL-locking in tun/tap driver, Kim B. Heino, (Wed Feb 27, 5:38 am)
Re: [PATCH] fix RTNL-locking in tun/tap driver, David Miller, (Fri Feb 29, 4:26 pm)
speck-geostationary