[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150311.212112.908171202958424986.davem@davemloft.net>
Date: Wed, 11 Mar 2015 21:21:12 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: netdev@...r.kernel.org, salo@...gle.com
Subject: Re: [PATCH net-next] net: add real socket cookies
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Wed, 11 Mar 2015 15:30:35 -0700
> Note that sk_clone_lock() really does the clear for us :
>
> net/core/sock.c:1541: atomic64_set(&newsk->sk_cookie, 0);
>
> atomic_cmpxchg() is needed here in case a concurrent dumper already
> caught the new socket.
How is newsk visible at this moment?
It is freshly allocated, and not present in any tables. Nothing even
indirectly links to it at this point.
Visibility only happens after we return from this function, in
routines such as tcp_v4_syn_recv_sock() which do the hash table
insertion.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists