mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
tcp: initialize send sequence numbers before deferring TFO
TCP_FASTOPEN_CONNECT can return from connect() before tcp_connect_init()
when a cached cookie or cookieless Fast Open allows deferring the SYN.
At this point write_seq contains the initial sequence number, while
snd_una and snd_nxt have not been initialized to that sequence number.
Consequently, inet_diag and /proc/net/tcp{,6} report the initial
sequence number as the send queue length despite no SYN or payload being
queued.
Initialize snd_una and snd_nxt to write_seq before marking the
connection as deferred. Both sequence-based queue lengths then remain
zero until the first write starts the connection and runs
tcp_connect_init().
Fixes: 19f6d3f3c8 ("net/tcp-fastopen: Add new API support")
Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Link: https://patch.msgid.link/20261102035943.9700-1-qingfang.deng@linux.dev
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
37dfd0efbf
commit
57889a8f6d
|
|
@ -545,6 +545,8 @@ bool tcp_fastopen_defer_connect(struct sock *sk, int *err)
|
|||
|
||||
if (tp->fastopen_connect && !tp->fastopen_req) {
|
||||
if (tcp_fastopen_cookie_check(sk, &mss, &cookie)) {
|
||||
WRITE_ONCE(tp->snd_una, tp->write_seq);
|
||||
WRITE_ONCE(tp->snd_nxt, tp->write_seq);
|
||||
inet_set_bit(DEFER_CONNECT, sk);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user