summaryrefslogtreecommitdiffstats
path: root/include/net/inet_connection_sock.h
diff options
context:
space:
mode:
authorEric Dumazet2015-03-16 05:12:16 +0100
committerDavid S. Miller2015-03-16 20:55:29 +0100
commit13854e5a60461daee08ce99842b7f4d37553d911 (patch)
treef7bf7650ead7d8af1e93d98114da5cd1bf658956 /include/net/inet_connection_sock.h
parentinet: factorize sock_edemux()/sock_gen_put() code (diff)
downloadkernel-qcow2-linux-13854e5a60461daee08ce99842b7f4d37553d911.tar.gz
kernel-qcow2-linux-13854e5a60461daee08ce99842b7f4d37553d911.tar.xz
kernel-qcow2-linux-13854e5a60461daee08ce99842b7f4d37553d911.zip
inet: add proper refcounting to request sock
reqsk_put() is the generic function that should be used to release a refcount (and automatically call reqsk_free()) reqsk_free() might be called if refcount is known to be 0 or undefined. refcnt is set to one in inet_csk_reqsk_queue_add() As request socks are not yet in global ehash table, I added temporary debugging checks in reqsk_put() and reqsk_free() Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inet_connection_sock.h')
-rw-r--r--include/net/inet_connection_sock.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index b9a6b0a94cc6..191feec60205 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -275,6 +275,11 @@ static inline void inet_csk_reqsk_queue_add(struct sock *sk,
struct sock *child)
{
reqsk_queue_add(&inet_csk(sk)->icsk_accept_queue, req, sk, child);
+ /* before letting lookups find us, make sure all req fields
+ * are committed to memory.
+ */
+ smp_wmb();
+ atomic_set(&req->rsk_refcnt, 1);
}
void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,