public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Kim B. Heino" <Kim.Heino@bluegiga.com>
To: maxk@qualcomm.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fix RTNL-locking in tun/tap driver
Date: Wed, 27 Feb 2008 11:38:21 +0200	[thread overview]
Message-ID: <47C52F8D.7020301@bluegiga.com> (raw)

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

             reply	other threads:[~2008-02-27 10:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27  9:38 Kim B. Heino [this message]
2008-02-29 20:26 ` [PATCH] fix RTNL-locking in tun/tap driver David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47C52F8D.7020301@bluegiga.com \
    --to=kim.heino@bluegiga.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxk@qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox