Skip to content

Commit 578c18e

Browse files
Paolo Abenikuba-moo
authored andcommitted
mptcp: fix splat when closing unaccepted socket
If userspace exits before calling accept() on a listener that had at least one new connection ready, we get: Attempt to release TCP socket in state 8 This happens because the mptcp socket gets cloned when the TCP connection is ready, but the socket is never exposed to userspace. The client additionally sends a DATA_FIN, which brings connection into CLOSE_WAIT state. This in turn prevents the orphan+state reset fixup in mptcp_sock_destruct() from doing its job. Fixes: 3721b9b ("mptcp: Track received DATA_FIN sequence number and add related helpers") Closes: multipath-tcp/mptcp_net-next#185 Tested-by: Florian Westphal <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a6f8ee5 commit 578c18e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/mptcp/subflow.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,7 @@ static void mptcp_sock_destruct(struct sock *sk)
546546
* ESTABLISHED state and will not have the SOCK_DEAD flag.
547547
* Both result in warnings from inet_sock_destruct.
548548
*/
549-
550-
if (sk->sk_state == TCP_ESTABLISHED) {
549+
if ((1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) {
551550
sk->sk_state = TCP_CLOSE;
552551
WARN_ON_ONCE(sk->sk_socket);
553552
sock_orphan(sk);

0 commit comments

Comments
 (0)