Netdev List
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: Eric Dumazet <edumazet@kernel.org>,
	Neal Cardwell <ncardwell@google.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Yuchung Cheng <ycheng@google.com>, Wei Wang <weiwan@google.com>,
	Mat Martineau <martineau@kernel.org>,
	Geliang Tang <geliang@kernel.org>,
	Simon Horman <horms@kernel.org>,
	Kuniyuki Iwashima <kuni1840@gmail.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v1 net 1/3] tcp: Clear DEFER_CONNECT before tcp_connect() and in tcp_abort().
Date: Tue, 10 Nov 2026 20:14:42 +0100	[thread overview]
Message-ID: <5c296ec6-c68e-4f70-91f9-1771afe300a4@kernel.org> (raw)
In-Reply-To: <CAAVpQUDSecbKNPnw7FT=jtSq5Py-bXKyLv=OxVStdOt0uGQb7w@mail.gmail.com>

On 10/11/2026 20:12, Kuniyuki Iwashima wrote:
> On Tue, Nov 10, 2026 at 10:46 AM Matthieu Baerts <matttbe@kernel.org> wrote:
>>
>> Hi Kuniyuki,
>>
>> On 08/11/2026 00:56, Kuniyuki Iwashima wrote:
>>> When TFO is enabled, tcp_v[46]_connect() sets sk->sk_state to
>>> TCP_SYN_SENT and puts the socket into ehash without calling
>>> tcp_connect().
>>>
>>> Then, tcp_fastopen_defer_connect() sets DEFER_CONNECT, and
>>> the first write()/sendmsg() will call tcp_connect() and send
>>> SYN with data if possible.
>>>
>>> If tcp_abort() kills a socket before the first write()/sendmsg(),
>>> the unhashed socket can still call it and send SYN in TCP_CLOSE.
>>>
>>> Also, DEFER_CONNECT is cleared after __inet_stream_connect().
>>>
>>> So, blocking write()/sendmsg() can release lock_sock() in
>>> inet_wait_for_connect() while DEFER_CONNECT is set, and
>>> tcp_poll() could set EPOLLOUT even after SYN is sent.
>>>
>>> Let's clear DEFER_CONNECT in tcp_abort() and right before
>>> tcp_connect() in tcp_sendmsg_fastopen().
>>
>> Thank you for the fix!
>>
>> It looks like we can still have the race with MPTCP:
>>
>> https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261107235720.3129212-1-kuniyu%40google.com
>>
>> But that's not blocking this series here, so for the MPTCP part:
>>
>> Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> 
> Thanks Matt !
> 
>>
>>
>> Just to avoid a deadlock, are you planning to fix the issue on MPTCP
>> side as well? If not, I can look at that later on when I can.
> 
> I would appreciate it if you could look into it.

Sure, I will wait for this series to be applied first.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


  reply	other threads:[~2026-11-10 19:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 23:56 [PATCH v1 net 0/3] tcp: Small fixes for DEFER_CONNECT Kuniyuki Iwashima
2026-11-07 23:56 ` [PATCH v1 net 1/3] tcp: Clear DEFER_CONNECT before tcp_connect() and in tcp_abort() Kuniyuki Iwashima
2026-11-10 18:46   ` Matthieu Baerts
2026-11-10 19:12     ` Kuniyuki Iwashima
2026-11-10 19:14       ` Matthieu Baerts [this message]
2026-11-07 23:56 ` [PATCH v1 net 2/3] tcp: Drop any segments if DEFER_CONNECT is set Kuniyuki Iwashima
2026-11-07 23:56 ` [PATCH v1 net 3/3] selftest: packetdrill: Add test for DEFER_CONNECT Kuniyuki Iwashima
2026-11-11 22:12 ` [PATCH v1 net 0/3] tcp: Small fixes " patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c296ec6-c68e-4f70-91f9-1771afe300a4@kernel.org \
    --to=matttbe@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=geliang@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@google.com \
    --cc=martineau@kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=weiwan@google.com \
    --cc=ycheng@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox