All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-net] mptcp: really cope with fastopen race.
@ 2024-01-24 21:36 Paolo Abeni
  2024-01-24 22:43 ` mptcp: really cope with fastopen race.: Tests Results MPTCP CI
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Paolo Abeni @ 2024-01-24 21:36 UTC (permalink / raw)
  To: mptcp

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")
Reported-by: syzbot+c53d4d3ddb327e80bc51@syzkaller.appspotmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/mptcp/protocol.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 4a32d3d11fb6..de04b97e8dd1 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -1171,7 +1171,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;
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-02-05 16:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-24 21:36 [PATCH mptcp-net] mptcp: really cope with fastopen race Paolo Abeni
2024-01-24 22:43 ` mptcp: really cope with fastopen race.: Tests Results MPTCP CI
2024-01-24 22:43 ` MPTCP CI
2024-01-27  1:18 ` [PATCH mptcp-net] mptcp: really cope with fastopen race Mat Martineau
2024-01-29  9:35   ` Paolo Abeni
2024-01-29 19:16     ` Mat Martineau
2024-01-30  8:38       ` Paolo Abeni
2024-01-27  2:24 ` mptcp: really cope with fastopen race.: Tests Results MPTCP CI
2024-01-27  3:23 ` MPTCP CI
2024-01-30 12:08 ` [PATCH mptcp-net] mptcp: really cope with fastopen race Matthieu Baerts
2024-02-05 16:00 ` Paolo Abeni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.