Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f1f2c62 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Revert "tcp: deny tcp_disconnect() when threads are waiting"



This reverts commit 0377416c which is
commit 4faeee0cf8a5d88d63cdbc3bab124fb0e6aed08c upstream.

It breaks the Android kernel abi, and if it is needed it can be brought
back in an ABI-safe way in the future.

Bug: 161946584
Change-Id: I80e8272468138b5144f9780b6ea5f8d107988e2a
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 0ec5f569
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -313,7 +313,6 @@ struct sock_common {
  *	@sk_cgrp_data: cgroup data for this cgroup
  *	@sk_memcg: this socket's memory cgroup association
  *	@sk_write_pending: a write to stream socket waits to start
  *	@sk_wait_pending: number of threads blocked on this socket
  *	@sk_state_change: callback to indicate change in the state of the sock
  *	@sk_data_ready: callback to indicate there is data to be processed
  *	@sk_write_space: callback to indicate there is bf sending space available
@@ -394,7 +393,6 @@ struct sock {
	unsigned int		sk_napi_id;
#endif
	int			sk_rcvbuf;
	int			sk_wait_pending;

	struct sk_filter __rcu	*sk_filter;
	union {
@@ -1030,7 +1028,6 @@ static inline void sock_rps_reset_rxhash(struct sock *sk)

#define sk_wait_event(__sk, __timeo, __condition, __wait)		\
	({	int __rc;						\
		__sk->sk_wait_pending++;				\
		release_sock(__sk);					\
		__rc = __condition;					\
		if (!__rc) {						\
@@ -1040,7 +1037,6 @@ static inline void sock_rps_reset_rxhash(struct sock *sk)
		}							\
		sched_annotate_sleep();					\
		lock_sock(__sk);					\
		__sk->sk_wait_pending--;				\
		__rc = __condition;					\
		__rc;							\
	})
+0 −2
Original line number Diff line number Diff line
@@ -578,7 +578,6 @@ static long inet_wait_for_connect(struct sock *sk, long timeo, int writebias)

	add_wait_queue(sk_sleep(sk), &wait);
	sk->sk_write_pending += writebias;
	sk->sk_wait_pending++;

	/* Basic assumption: if someone sets sk->sk_err, he _must_
	 * change state of the socket from TCP_SYN_*.
@@ -594,7 +593,6 @@ static long inet_wait_for_connect(struct sock *sk, long timeo, int writebias)
	}
	remove_wait_queue(sk_sleep(sk), &wait);
	sk->sk_write_pending -= writebias;
	sk->sk_wait_pending--;
	return timeo;
}

+0 −1
Original line number Diff line number Diff line
@@ -826,7 +826,6 @@ struct sock *inet_csk_clone_lock(const struct sock *sk,
	if (newsk) {
		struct inet_connection_sock *newicsk = inet_csk(newsk);

		newsk->sk_wait_pending = 0;
		inet_sk_set_state(newsk, TCP_SYN_RECV);
		newicsk->icsk_bind_hash = NULL;

+0 −6
Original line number Diff line number Diff line
@@ -2561,12 +2561,6 @@ int tcp_disconnect(struct sock *sk, int flags)
	int old_state = sk->sk_state;
	u32 seq;

	/* Deny disconnect if other threads are blocked in sk_wait_event()
	 * or inet_wait_for_connect().
	 */
	if (sk->sk_wait_pending)
		return -EBUSY;

	if (old_state != TCP_CLOSE)
		tcp_set_state(sk, TCP_CLOSE);