netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] mptcp: fix splat when closing unaccepted socket
@ 2021-05-07  0:16 Mat Martineau
  2021-05-07 23:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Mat Martineau @ 2021-05-07  0:16 UTC (permalink / raw)
  To: netdev
  Cc: Paolo Abeni, davem, kuba, matthieu.baerts, mptcp,
	Florian Westphal, Mat Martineau

From: Paolo Abeni <pabeni@redhat.com>

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: 3721b9b64676b ("mptcp: Track received DATA_FIN sequence number and add related helpers")
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/185
Tested-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
 net/mptcp/subflow.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 82e91b00ad39..a5ede357cfbc 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -546,8 +546,7 @@ static void mptcp_sock_destruct(struct sock *sk)
 	 * ESTABLISHED state and will not have the SOCK_DEAD flag.
 	 * Both result in warnings from inet_sock_destruct.
 	 */
-
-	if (sk->sk_state == TCP_ESTABLISHED) {
+	if ((1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) {
 		sk->sk_state = TCP_CLOSE;
 		WARN_ON_ONCE(sk->sk_socket);
 		sock_orphan(sk);

base-commit: 8621436671f3a4bba5db57482e1ee604708bf1eb
-- 
2.31.1


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

* Re: [PATCH net] mptcp: fix splat when closing unaccepted socket
  2021-05-07  0:16 [PATCH net] mptcp: fix splat when closing unaccepted socket Mat Martineau
@ 2021-05-07 23:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-07 23:10 UTC (permalink / raw)
  To: Mat Martineau; +Cc: netdev, pabeni, davem, kuba, matthieu.baerts, mptcp, fw

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu,  6 May 2021 17:16:38 -0700 you wrote:
> From: Paolo Abeni <pabeni@redhat.com>
> 
> 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
> 
> [...]

Here is the summary with links:
  - [net] mptcp: fix splat when closing unaccepted socket
    https://git.kernel.org/netdev/net/c/578c18eff162

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-05-07 23:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07  0:16 [PATCH net] mptcp: fix splat when closing unaccepted socket Mat Martineau
2021-05-07 23:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).