mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
Revert "bpf, sockmap: Handle fin correctly"
This reverts commit 3a2129ebae.
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: Ib4d8c98270484b4d2c63e838bbe0d24c00642f87
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -174,24 +174,6 @@ static int tcp_msg_wait_data(struct sock *sk, struct sk_psock *psock,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_next_msg_fin(struct sk_psock *psock)
|
|
||||||
{
|
|
||||||
struct scatterlist *sge;
|
|
||||||
struct sk_msg *msg_rx;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
msg_rx = sk_psock_peek_msg(psock);
|
|
||||||
i = msg_rx->sg.start;
|
|
||||||
sge = sk_msg_elem(msg_rx, i);
|
|
||||||
if (!sge->length) {
|
|
||||||
struct sk_buff *skb = msg_rx->skb;
|
|
||||||
|
|
||||||
if (skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int tcp_bpf_recvmsg_parser(struct sock *sk,
|
static int tcp_bpf_recvmsg_parser(struct sock *sk,
|
||||||
struct msghdr *msg,
|
struct msghdr *msg,
|
||||||
size_t len,
|
size_t len,
|
||||||
@@ -214,19 +196,6 @@ static int tcp_bpf_recvmsg_parser(struct sock *sk,
|
|||||||
lock_sock(sk);
|
lock_sock(sk);
|
||||||
msg_bytes_ready:
|
msg_bytes_ready:
|
||||||
copied = sk_msg_recvmsg(sk, psock, msg, len, flags);
|
copied = sk_msg_recvmsg(sk, psock, msg, len, flags);
|
||||||
/* The typical case for EFAULT is the socket was gracefully
|
|
||||||
* shutdown with a FIN pkt. So check here the other case is
|
|
||||||
* some error on copy_page_to_iter which would be unexpected.
|
|
||||||
* On fin return correct return code to zero.
|
|
||||||
*/
|
|
||||||
if (copied == -EFAULT) {
|
|
||||||
bool is_fin = is_next_msg_fin(psock);
|
|
||||||
|
|
||||||
if (is_fin) {
|
|
||||||
copied = 0;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!copied) {
|
if (!copied) {
|
||||||
long timeo;
|
long timeo;
|
||||||
int data;
|
int data;
|
||||||
|
|||||||
Reference in New Issue
Block a user