From 6151e5151b2196d0d72197729018da7c5c3040a2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 16 Apr 2025 09:43:52 +0000 Subject: [PATCH] Revert "tcp: fix races in tcp_abort()" This reverts commit cae9d2b1624bb74c5c070be9a16871c00a7cb7fc which is commit 5ce4645c23cf5f048eb8e9ce49e514bababdee85 upstream. It breaks Android testing and can be brought back in the future in an safe way if it is really needed. Bug: 411037744 Change-Id: I02ba2e4b3c519bad7686ddec5fa8a8ff7036768b Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 096fd6309077..3b8e31f456c1 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -4739,9 +4739,13 @@ int tcp_abort(struct sock *sk, int err) bh_lock_sock(sk); if (!sock_flag(sk, SOCK_DEAD)) { + WRITE_ONCE(sk->sk_err, err); + /* This barrier is coupled with smp_rmb() in tcp_poll() */ + smp_wmb(); + sk_error_report(sk); if (tcp_need_reset(sk->sk_state)) tcp_send_active_reset(sk, GFP_ATOMIC); - tcp_done_with_error(sk, err); + tcp_done(sk); } bh_unlock_sock(sk);