netdev
[Top] [All Lists]

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

To: Lennert Buytenhek <buytenh@xxxxxxxxxxxxxx>
Subject: Re: race in net/ipv4/ipip.c ?
From: Thomas Graf <tgraf@xxxxxxx>
Date: Wed, 12 Jan 2005 13:53:36 +0100
Cc: netdev@xxxxxxxxxxx
In-reply-to: <20050112122300.GA12155@xi.wantstofly.org>
References: <20050112122300.GA12155@xi.wantstofly.org>
Sender: netdev-bounce@xxxxxxxxxxx
* Lennert Buytenhek <20050112122300.GA12155@xxxxxxxxxxxxxxxxx> 2005-01-12 13:23
> Hi!
> 
>       static void ipip_tunnel_link(struct ipip_tunnel *t)
>       {
>               struct ipip_tunnel **tp = ipip_bucket(t);
> 
>               t->next = *tp;
>               write_lock_bh(&ipip_lock);
>               *tp = t;
>               write_unlock_bh(&ipip_lock);
>       }
> 
> Shouldn't the "t->next = *tp" be done inside the write lock?

Why do you think so? linking may only happen on new tunnels
so they can't be found before they're assigned to the bucket.
dev_hold is called correctly so dev->priv usage is safe as
well.

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