mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
Merge b753821e06 ("tcp: fix forever orphan socket caused by tcp_abort") into android14-6.1-lts
Steps on the way to 6.1.132 Change-Id: Ifc65292ebb54b517fddc9c4ece3a8513d1259bb3 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -4729,6 +4729,12 @@ int tcp_abort(struct sock *sk, int err)
|
||||
/* Don't race with userspace socket closes such as tcp_close. */
|
||||
lock_sock(sk);
|
||||
|
||||
/* Avoid closing the same socket twice. */
|
||||
if (sk->sk_state == TCP_CLOSE) {
|
||||
release_sock(sk);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
if (sk->sk_state == TCP_LISTEN) {
|
||||
tcp_set_state(sk, TCP_CLOSE);
|
||||
inet_csk_listen_stop(sk);
|
||||
@@ -4738,15 +4744,12 @@ int tcp_abort(struct sock *sk, int err)
|
||||
local_bh_disable();
|
||||
bh_lock_sock(sk);
|
||||
|
||||
if (!sock_flag(sk, SOCK_DEAD)) {
|
||||
if (tcp_need_reset(sk->sk_state))
|
||||
tcp_send_active_reset(sk, GFP_ATOMIC);
|
||||
tcp_done_with_error(sk, err);
|
||||
}
|
||||
if (tcp_need_reset(sk->sk_state))
|
||||
tcp_send_active_reset(sk, GFP_ATOMIC);
|
||||
tcp_done_with_error(sk, err);
|
||||
|
||||
bh_unlock_sock(sk);
|
||||
local_bh_enable();
|
||||
tcp_write_queue_purge(sk);
|
||||
release_sock(sk);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user