netdev
[Top] [All Lists]

Re: race in net/ipv4/ipip.c ?

To: davem@xxxxxxxxxxxxx
Subject: Re: race in net/ipv4/ipip.c ?
From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@xxxxxxxxxxxxxx>
Date: Wed, 12 Jan 2005 22:36:00 +0900 (JST)
Cc: tgraf@xxxxxxx, buytenh@xxxxxxxxxxxxxx, netdev@xxxxxxxxxxx, yoshfuji@xxxxxxxxxxxxxx
In-reply-to: <20050112132126.GI26856@postel.suug.ch>
Organization: USAGI Project
References: <20050112125336.GH26856@postel.suug.ch> <20050112.220816.56650893.yoshfuji@linux-ipv6.org> <20050112132126.GI26856@postel.suug.ch>
Sender: netdev-bounce@xxxxxxxxxxx
In article <20050112132126.GI26856@xxxxxxxxxxxxxx> (at Wed, 12 Jan 2005 
14:21:26 +0100), Thomas Graf <tgraf@xxxxxxx> says:

> * YOSHIFUJI Hideaki / ?$B5HF#1QL@ 
> <20050112.220816.56650893.yoshfuji@xxxxxxxxxxxxxx> 2005-01-12 22:08
> > How about adding multiple tunnels (with same ipip_bucket(t))
> > concurrently? :-)
> > 
> 
> * Lennert Buytenhek <20050112130940.GA12547@xxxxxxxxxxxxxxxxx> 2005-01-12 
> 14:09
> > What if you add two tunnels at the same time?  (Or is that perhaps
> > synchronised on a higher level?)
> 
> Not possible, protected via rtnl semaphore acquired in default
> handler of dev_ioctl.

Good.


David, I think we need to fix sit.c, anyway.

Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@xxxxxxxxxxxxxx>

===== net/ipv6/sit.c 1.43 vs edited =====
--- 1.43/net/ipv6/sit.c 2004-10-04 07:03:07 +09:00
+++ edited/net/ipv6/sit.c       2005-01-12 22:29:32 +09:00
@@ -135,10 +135,10 @@
 {
        struct ip_tunnel **tp = ipip6_bucket(t);
 
-       write_lock_bh(&ipip6_lock);
        t->next = *tp;
-       write_unlock_bh(&ipip6_lock);
+       write_lock_bh(&ipip6_lock);
        *tp = t;
+       write_unlock_bh(&ipip6_lock);
 }
 
 static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, 
int create)

--yoshfuji

<Prev in Thread] Current Thread [Next in Thread>