]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tcp: fix __tcp_close() to only send RST when required
authorEric Dumazet <edumazet@google.com>
Wed, 3 Sep 2025 08:47:18 +0000 (08:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 09:56:32 +0000 (11:56 +0200)
commitd9454612049e4ef266e24e65a3b9f309f6bf1bb2
treeddb82d4c593433c5673212842b2d1805ff975265
parent352f0a4c0d063be5a55f13ae68c4e7215d9e85d9
tcp: fix __tcp_close() to only send RST when required

[ Upstream commit 5f9238530970f2993b23dd67fdaffc552a2d2e98 ]

If the receive queue contains payload that was already
received, __tcp_close() can send an unexpected RST.

Refine the code to take tp->copied_seq into account,
as we already do in tcp recvmsg().

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Link: https://patch.msgid.link/20250903084720.1168904-2-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/tcp.c