diff options
author | Paolo Abeni <pabeni@redhat.com> | 2024-02-08 19:03:54 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-02-23 09:25:01 +0100 |
commit | 4bfe217e075d04e63c092df9d40c608e598c2ef2 (patch) | |
tree | 53c00edf5d4fc1ff8c34f6d2f99d8a96fcbfec6d /net | |
parent | ed34dfa19ddbd1e4c85a73636f8cba0211025ea4 (diff) | |
download | linux-stable-4bfe217e075d04e63c092df9d40c608e598c2ef2.tar.gz linux-stable-4bfe217e075d04e63c092df9d40c608e598c2ef2.tar.bz2 linux-stable-4bfe217e075d04e63c092df9d40c608e598c2ef2.zip |
mptcp: really cope with fastopen race
commit 337cebbd850f94147cee05252778f8f78b8c337f upstream.
Fastopen and PM-trigger subflow shutdown can race, as reported by
syzkaller.
In my first attempt to close such race, I missed the fact that
the subflow status can change again before the subflow_state_change
callback is invoked.
Address the issue additionally copying with all the states directly
reachable from TCP_FIN_WAIT1.
Fixes: 1e777f39b4d7 ("mptcp: add MSG_FASTOPEN sendmsg flag support")
Fixes: 4fd19a307016 ("mptcp: fix inconsistent state on fastopen race")
Cc: stable@vger.kernel.org
Reported-by: syzbot+c53d4d3ddb327e80bc51@syzkaller.appspotmail.com
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/458
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/mptcp/protocol.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 891757e22f3e..094d3fd47a92 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1104,7 +1104,8 @@ static inline bool subflow_simultaneous_connect(struct sock *sk) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_FIN_WAIT1) && + return (1 << sk->sk_state) & + (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING) && is_active_ssk(subflow) && !subflow->conn_finished; } |