diff options
author | Eric Dumazet <edumazet@google.com> | 2015-03-18 02:32:31 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-18 03:02:29 +0100 |
commit | 0470c8ca1d57927f2cc3e1d5add1fb2834609447 (patch) | |
tree | 798f475f48fbdff0eae359c3f345a1a0eaf83ca2 /net/ipv4/tcp_fastopen.c | |
parent | inet: avoid fastopen lock for regular accept() (diff) | |
download | linux-0470c8ca1d57927f2cc3e1d5add1fb2834609447.tar.xz linux-0470c8ca1d57927f2cc3e1d5add1fb2834609447.zip |
inet: fix request sock refcounting
While testing last patch series, I found req sock refcounting was wrong.
We must set skc_refcnt to 1 for all request socks added in hashes,
but also on request sockets created by FastOpen or syncookies.
It is tricky because we need to defer this initialization so that
future RCU lookups do not try to take a refcount on a not yet
fully initialized request socket.
Also get rid of ireq_refcnt alias.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: 13854e5a6046 ("inet: add proper refcounting to request sock")
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_fastopen.c')
-rw-r--r-- | net/ipv4/tcp_fastopen.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 186fd394ec0a..82e375a0cbcf 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c @@ -169,6 +169,7 @@ static bool tcp_fastopen_create_child(struct sock *sk, inet_csk_reset_xmit_timer(child, ICSK_TIME_RETRANS, TCP_TIMEOUT_INIT, TCP_RTO_MAX); + atomic_set(&req->rsk_refcnt, 1); /* Add the child socket directly into the accept queue */ inet_csk_reqsk_queue_add(sk, req, child); |