From 3ce63059c1912136974daa9ecbc5a5f34e2c1ac1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 14 Jun 2023 16:16:00 +0000 Subject: [PATCH] Revert "bpf, sockmap: TCP data stall on recv before accept" This reverts commit ab90b68f650e1b78ec266b701365634b5270fe34. It breaks the Android KABI and will be brought back at a later time when it is safe to do so. Bug: 161946584 Change-Id: If61ba37db2a3ea1642c9e5c9295e2d7d4a94207b Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_bpf.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c index 01dd76be1a58..73c13642d47f 100644 --- a/net/ipv4/tcp_bpf.c +++ b/net/ipv4/tcp_bpf.c @@ -212,26 +212,6 @@ static int tcp_bpf_recvmsg_parser(struct sock *sk, return tcp_recvmsg(sk, msg, len, flags, addr_len); lock_sock(sk); - - /* We may have received data on the sk_receive_queue pre-accept and - * then we can not use read_skb in this context because we haven't - * assigned a sk_socket yet so have no link to the ops. The work-around - * is to check the sk_receive_queue and in these cases read skbs off - * queue again. The read_skb hook is not running at this point because - * of lock_sock so we avoid having multiple runners in read_skb. - */ - if (unlikely(!skb_queue_empty(&sk->sk_receive_queue))) { - tcp_data_ready(sk); - /* This handles the ENOMEM errors if we both receive data - * pre accept and are already under memory pressure. At least - * let user know to retry. - */ - if (unlikely(!skb_queue_empty(&sk->sk_receive_queue))) { - copied = -EAGAIN; - goto out; - } - } - msg_bytes_ready: copied = sk_msg_recvmsg(sk, psock, msg, len, flags); /* The typical case for EFAULT is the socket was gracefully