summaryrefslogtreecommitdiff
path: root/net/ipv4/tcp_timer.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-05-29 17:21:37 -0700
committerJakub Kicinski <kuba@kernel.org>2024-05-29 17:21:38 -0700
commit0f4b437b5fbf5141ff886bb47581123eb222c543 (patch)
treefc8014baaf67f7eb33fa5249a7c068a43438c7cc /net/ipv4/tcp_timer.c
parentc3390677f6258748a91bf37b9bb21eab89f63b42 (diff)
parentfde6f897f2a184546bf5516ac736523ef24dc6a7 (diff)
Merge branch 'tcp-fix-tcp_poll-races'
Eric Dumazet says: ==================== tcp: fix tcp_poll() races Flakes in packetdrill tests stressing epoll_wait() were root caused to bad ordering in tcp_write_err() Precisely, we have to call sk_error_report() after tcp_done(). When fixing this issue, we discovered tcp_abort(), tcp_v4_err() and tcp_v6_err() had similar issues. Since tcp_reset() has the correct ordering, first patch takes part of it and creates tcp_done_with_error() helper. ==================== Link: https://lore.kernel.org/r/20240528125253.1966136-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv4/tcp_timer.c')
-rw-r--r--net/ipv4/tcp_timer.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 83fe7f62f7f1..3e8604ae7d06 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -74,11 +74,7 @@ u32 tcp_clamp_probe0_to_user_timeout(const struct sock *sk, u32 when)
static void tcp_write_err(struct sock *sk)
{
- WRITE_ONCE(sk->sk_err, READ_ONCE(sk->sk_err_soft) ? : ETIMEDOUT);
- sk_error_report(sk);
-
- tcp_write_queue_purge(sk);
- tcp_done(sk);
+ tcp_done_with_error(sk, READ_ONCE(sk->sk_err_soft) ? : ETIMEDOUT);
__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONTIMEOUT);
}