LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] fix RTNL-locking in tun/tap driver
@ 2008-02-27  9:38 Kim B. Heino
  2008-02-29 20:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Kim B. Heino @ 2008-02-27  9:38 UTC (permalink / raw)
  To: maxk; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix RTNL-locking in tun/tap driver
  2008-02-27  9:38 [PATCH] fix RTNL-locking in tun/tap driver Kim B. Heino
@ 2008-02-29 20:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-02-29 20:26 UTC (permalink / raw)
  To: Kim.Heino; +Cc: maxk, linux-kernel

From: "Kim B. Heino" <Kim.Heino@bluegiga.com>
Date: Wed, 27 Feb 2008 11:38:21 +0200

> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-29 20:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-27  9:38 [PATCH] fix RTNL-locking in tun/tap driver Kim B. Heino
2008-02-29 20:26 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).