Netdev List
 help / color / mirror / Atom feed
* [PATCH v1 net] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req().
@ 2026-11-11  2:03 Kuniyuki Iwashima
  2026-11-11  2:06 ` netdev-bot+sinfo
  2026-11-12 18:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2026-11-11  2:03 UTC (permalink / raw)
  To: Eric Dumazet, Neal Cardwell, David S. Miller, Jakub Kicinski,
	Paolo Abeni
  Cc: Martin KaFai Lau, Daniel Borkmann, Simon Horman,
	Kuniyuki Iwashima, Kuniyuki Iwashima, netdev

When connection migration happens in tcp_v[46]_rcv(), a new
listener is passed to tcp_check_req().

When either of the following is true,

  * the new listener queue is full and
    net.ipv4.tcp_abort_on_overflow is set

  * the packet has RST or (not stripped) SYN

tcp_check_req() sends RST and calls inet_csk_reqsk_queue_drop().

Here, the new listener is passed, and its qlen is decremented
wrongly while reqsk is tied to the old listener.

Once qlen underflows, inet_csk_reqsk_queue_is_full() always
return true, and the new listener stops serving.

Without the patch, this script times out while waiting for SYN+ACK
since the new listener drops SYN, but with the patch, 3WHS completes.

    0 `sysctl -q net.ipv4.tcp_migrate_req=1`
   +0 `sysctl -q net.ipv4.tcp_syncookies=0`
   +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
   +0 setsockopt(4, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0
   +0 bind(4, ..., ...) = 0
   +0 listen(4, 128) = 0
   +0 < S 0:0(0) win 32792 <mss 1000>
   +0 > S. 0:0(0) ack 1 <...>
   +0 listen(3, 128) = 0
   +0 close(4) = 0
 +.01 < R 1:1(0) win 0
   +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 5
   +0 listen(5, 1) = 0
 +.01 < S 0:0(0) win 32792 <mss 1000>
   +0 > S. 0:0(0) ack 1 <...>
   +0 < . 1:1(0) ack 1 win 32792
   +0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
   +0 accept(3, ..., ...) = 6

Let's pass req->rsk_listener instead.

Fixes: d4f2c86b2b7e ("tcp: Migrate TCP_NEW_SYN_RECV requests at receiving the final ACK.")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
one-shot bug will not be worth a new test file.
---
 net/ipv4/tcp_minisocks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 0ddfd5af6e58..a05bb02e204c 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -974,7 +974,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
 		tcp_reset(sk, skb);
 	}
 	if (!fastopen) {
-		bool unlinked = inet_csk_reqsk_queue_drop(sk, req);
+		bool unlinked = inet_csk_reqsk_queue_drop(req->rsk_listener, req);
 
 		if (unlinked)
 			__NET_INC_STATS(sock_net(sk), LINUX_MIB_EMBRYONICRSTS);
-- 
2.56.0.611.g1030f0b940-goog


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

* Re: [PATCH v1 net] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req().
  2026-11-11  2:03 [PATCH v1 net] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req() Kuniyuki Iwashima
@ 2026-11-11  2:06 ` netdev-bot+sinfo
  2026-11-11  2:08   ` Kuniyuki Iwashima
  2026-11-12 18:50 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: netdev-bot+sinfo @ 2026-11-11  2:06 UTC (permalink / raw)
  To: Kuniyuki Iwashima
  Cc: Eric Dumazet, Neal Cardwell, David S. Miller, Jakub Kicinski,
	Paolo Abeni, Martin KaFai Lau, Daniel Borkmann, Simon Horman,
	Kuniyuki Iwashima, netdev

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.

The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

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

* Re: [PATCH v1 net] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req().
  2026-11-11  2:06 ` netdev-bot+sinfo
@ 2026-11-11  2:08   ` Kuniyuki Iwashima
  0 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2026-11-11  2:08 UTC (permalink / raw)
  To: netdev-bot+sinfo
  Cc: Eric Dumazet, Neal Cardwell, David S. Miller, Jakub Kicinski,
	Paolo Abeni, Martin KaFai Lau, Daniel Borkmann, Simon Horman,
	Kuniyuki Iwashima, netdev

On Tue, Nov 10, 2026 at 6:06 PM <netdev-bot+sinfo@kernel.org> wrote:
>
> Hi!
>
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
>
>  - How the issue was discovered, e.g. hit in production, hit during
>    development, syzbot report, manual code inspection, LLM or static
>    analysis tool scan.

found by LLM scan.


>
> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account. If the series needs another revision for
> other reasons, please include the information in the commit messages
> then.
>
> The evaluation is done by an LLM so it may be wrong, if you think
> that is the case please reply and explain.

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

* Re: [PATCH v1 net] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req().
  2026-11-11  2:03 [PATCH v1 net] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req() Kuniyuki Iwashima
  2026-11-11  2:06 ` netdev-bot+sinfo
@ 2026-11-12 18:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-12 18:50 UTC (permalink / raw)
  To: Kuniyuki Iwashima
  Cc: edumazet, ncardwell, davem, kuba, pabeni, martin.lau, daniel,
	horms, kuni1840, netdev

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 11 Nov 2026 02:03:00 +0000 you wrote:
> When connection migration happens in tcp_v[46]_rcv(), a new
> listener is passed to tcp_check_req().
> 
> When either of the following is true,
> 
>   * the new listener queue is full and
>     net.ipv4.tcp_abort_on_overflow is set
> 
> [...]

Here is the summary with links:
  - [v1,net] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req().
    https://git.kernel.org/netdev/net/c/a9782a6f2bbd

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] 4+ messages in thread

end of thread, other threads:[~2026-11-12 18:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11  2:03 [PATCH v1 net] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req() Kuniyuki Iwashima
2026-11-11  2:06 ` netdev-bot+sinfo
2026-11-11  2:08   ` Kuniyuki Iwashima
2026-11-12 18:50 ` 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