From a5f2364ea6b10566053039b051072534742aa118 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 6 Nov 2023 14:48:34 +0000 Subject: [PATCH] Revert "tcp_bpf: properly release resources on error paths" This reverts commit 2efcdbef13c9e0f73c8cecb84cbe387eb8e4b453 which is commit 68b54aeff804acceb02f228ea2e28419272c1fb9 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 --- net/ipv4/tcp_bpf.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c index f8037d142bb7..cb4549db8bcf 100644 --- a/net/ipv4/tcp_bpf.c +++ b/net/ipv4/tcp_bpf.c @@ -302,10 +302,8 @@ msg_bytes_ready: } data = tcp_msg_wait_data(sk, psock, timeo); - if (data < 0) { - copied = data; - goto unlock; - } + if (data < 0) + return data; if (data && !sk_psock_queue_empty(psock)) goto msg_bytes_ready; copied = -EAGAIN; @@ -316,8 +314,6 @@ out: tcp_rcv_space_adjust(sk); if (copied > 0) __tcp_cleanup_rbuf(sk, copied); - -unlock: release_sock(sk); sk_psock_put(sk, psock); return copied; @@ -352,10 +348,8 @@ msg_bytes_ready: timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); data = tcp_msg_wait_data(sk, psock, timeo); - if (data < 0) { - ret = data; - goto unlock; - } + if (data < 0) + return data; if (data) { if (!sk_psock_queue_empty(psock)) goto msg_bytes_ready; @@ -366,8 +360,6 @@ msg_bytes_ready: copied = -EAGAIN; } ret = copied; - -unlock: release_sock(sk); sk_psock_put(sk, psock); return ret;