From 5418948a0a2d36117d7636e952befce45ca985d6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 29 Nov 2023 13:00:14 +0000 Subject: [PATCH] Revert "vsock/virtio: remove socket from connected/bound list on shutdown" This reverts commit 1fecefb0920c9d85ea0d1045cdb216c06c771e79 which is commit 3a5cc90a4d1756072619fe511d07621bdef7f120 upstream. It needs to be reverted, as the function virtio_transport_free_pkt() is in the stable Android ABI, and this function is removed in the 6.1.63 kernel as part of a series of fixes and optimizations of the virtio networking connection. To preserve the ABI (and thereby keeping the slower interface), revert the commit for now. If this needs to come back in the future, if performance for this interface needs to be resolved, it can be done so in an ABI-safe way. Bug: 161946584 Change-Id: If85ca36d955d97171fe83a56888e716cc5d52ccc Signed-off-by: Greg Kroah-Hartman --- net/vmw_vsock/virtio_transport_common.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 73e9e4b09bc4..3a3496b8dc18 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1112,17 +1112,11 @@ virtio_transport_recv_connected(struct sock *sk, vsk->peer_shutdown |= RCV_SHUTDOWN; if (le32_to_cpu(hdr->flags) & VIRTIO_VSOCK_SHUTDOWN_SEND) vsk->peer_shutdown |= SEND_SHUTDOWN; - if (vsk->peer_shutdown == SHUTDOWN_MASK) { - if (vsock_stream_has_data(vsk) <= 0 && !sock_flag(sk, SOCK_DONE)) { - (void)virtio_transport_reset(vsk, NULL); - virtio_transport_do_close(vsk, true); - } - /* Remove this socket anyway because the remote peer sent - * the shutdown. This way a new connection will succeed - * if the remote peer uses the same source port, - * even if the old socket is still unreleased, but now disconnected. - */ - vsock_remove_sock(vsk); + if (vsk->peer_shutdown == SHUTDOWN_MASK && + vsock_stream_has_data(vsk) <= 0 && + !sock_flag(sk, SOCK_DONE)) { + (void)virtio_transport_reset(vsk, NULL); + virtio_transport_do_close(vsk, true); } if (le32_to_cpu(virtio_vsock_hdr(skb)->flags)) sk->sk_state_change(sk);