Revert "tcp_bpf: properly release resources on error paths"

This reverts commit 2efcdbef13 which is
commit 68b54aeff8 upstream.

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

Bug: 161946584
Change-Id: Id1fb9acd3af73153dce124f7c4726250ecbc74c1
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2023-11-06 14:48:34 +00:00
parent 904cdc97d4
commit a5f2364ea6

View File

@@ -302,10 +302,8 @@ msg_bytes_ready:
} }
data = tcp_msg_wait_data(sk, psock, timeo); data = tcp_msg_wait_data(sk, psock, timeo);
if (data < 0) { if (data < 0)
copied = data; return data;
goto unlock;
}
if (data && !sk_psock_queue_empty(psock)) if (data && !sk_psock_queue_empty(psock))
goto msg_bytes_ready; goto msg_bytes_ready;
copied = -EAGAIN; copied = -EAGAIN;
@@ -316,8 +314,6 @@ out:
tcp_rcv_space_adjust(sk); tcp_rcv_space_adjust(sk);
if (copied > 0) if (copied > 0)
__tcp_cleanup_rbuf(sk, copied); __tcp_cleanup_rbuf(sk, copied);
unlock:
release_sock(sk); release_sock(sk);
sk_psock_put(sk, psock); sk_psock_put(sk, psock);
return copied; return copied;
@@ -352,10 +348,8 @@ msg_bytes_ready:
timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
data = tcp_msg_wait_data(sk, psock, timeo); data = tcp_msg_wait_data(sk, psock, timeo);
if (data < 0) { if (data < 0)
ret = data; return data;
goto unlock;
}
if (data) { if (data) {
if (!sk_psock_queue_empty(psock)) if (!sk_psock_queue_empty(psock))
goto msg_bytes_ready; goto msg_bytes_ready;
@@ -366,8 +360,6 @@ msg_bytes_ready:
copied = -EAGAIN; copied = -EAGAIN;
} }
ret = copied; ret = copied;
unlock:
release_sock(sk); release_sock(sk);
sk_psock_put(sk, psock); sk_psock_put(sk, psock);
return ret; return ret;