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

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

Revert "tcp: add annotations around sk->sk_shutdown accesses"



This reverts commit 35e4f2bc.  It is
part of a series that breaks the kernel abi for Android.  For this
kernel tree, we do not care so much about KASAN, so it's not a big issue
to revert.  If it is needed in the future, it can be brought back in an
abi-safe way.

Bug: 161946584
Change-Id: I0d17fa20bc0f80f72d89fc0553667155484f2282
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 67cb6605
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -865,7 +865,7 @@ int inet_shutdown(struct socket *sock, int how)
		   EPOLLHUP, even on eg. unconnected UDP sockets -- RR */
		/* fall through */
	default:
		WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | how);
		sk->sk_shutdown |= how;
		if (sk->sk_prot->shutdown)
			sk->sk_prot->shutdown(sk, how);
		break;
+6 −8
Original line number Diff line number Diff line
@@ -515,7 +515,6 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
	__poll_t mask;
	struct sock *sk = sock->sk;
	const struct tcp_sock *tp = tcp_sk(sk);
	u8 shutdown;
	int state;

	sock_poll_wait(file, sock, wait);
@@ -558,10 +557,9 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
	 * NOTE. Check for TCP_CLOSE is added. The goal is to prevent
	 * blocking on fresh not-connected or disconnected socket. --ANK
	 */
	shutdown = READ_ONCE(sk->sk_shutdown);
	if (shutdown == SHUTDOWN_MASK || state == TCP_CLOSE)
	if (sk->sk_shutdown == SHUTDOWN_MASK || state == TCP_CLOSE)
		mask |= EPOLLHUP;
	if (shutdown & RCV_SHUTDOWN)
	if (sk->sk_shutdown & RCV_SHUTDOWN)
		mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP;

	/* Connected or passive Fast Open socket? */
@@ -577,7 +575,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
		if (tcp_stream_is_readable(tp, target, sk))
			mask |= EPOLLIN | EPOLLRDNORM;

		if (!(shutdown & SEND_SHUTDOWN)) {
		if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
			if (__sk_stream_is_writeable(sk, 1)) {
				mask |= EPOLLOUT | EPOLLWRNORM;
			} else {  /* send SIGIO later */
@@ -2346,7 +2344,7 @@ void __tcp_close(struct sock *sk, long timeout)
	int data_was_unread = 0;
	int state;

	WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK);
	sk->sk_shutdown = SHUTDOWN_MASK;

	if (sk->sk_state == TCP_LISTEN) {
		tcp_set_state(sk, TCP_CLOSE);
@@ -2600,7 +2598,7 @@ int tcp_disconnect(struct sock *sk, int flags)
	if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK))
		inet_reset_saddr(sk);

	WRITE_ONCE(sk->sk_shutdown, 0);
	sk->sk_shutdown = 0;
	sock_reset_flag(sk, SOCK_DONE);
	tp->srtt_us = 0;
	tp->rcv_rtt_last_tsecr = 0;
@@ -3809,7 +3807,7 @@ void tcp_done(struct sock *sk)
	if (req)
		reqsk_fastopen_remove(sk, req, false);

	WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK);
	sk->sk_shutdown = SHUTDOWN_MASK;

	if (!sock_flag(sk, SOCK_DEAD))
		sk->sk_state_change(sk);
+2 −2
Original line number Diff line number Diff line
@@ -4130,7 +4130,7 @@ void tcp_fin(struct sock *sk)

	inet_csk_schedule_ack(sk);

	WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | RCV_SHUTDOWN);
	sk->sk_shutdown |= RCV_SHUTDOWN;
	sock_set_flag(sk, SOCK_DONE);

	switch (sk->sk_state) {
@@ -6209,7 +6209,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
			break;

		tcp_set_state(sk, TCP_FIN_WAIT2);
		WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | SEND_SHUTDOWN);
		sk->sk_shutdown |= SEND_SHUTDOWN;

		sk_dst_confirm(sk);