WSL2-Linux-Kernel/net/vmw_vsock
Zhuang Shengen 2832d62446 vsock: avoid to close connected socket after the timeout
[ Upstream commit 6d4486efe9 ]

When client and server establish a connection through vsock,
the client send a request to the server to initiate the connection,
then start a timer to wait for the server's response. When the server's
RESPONSE message arrives, the timer also times out and exits. The
server's RESPONSE message is processed first, and the connection is
established. However, the client's timer also times out, the original
processing logic of the client is to directly set the state of this vsock
to CLOSE and return ETIMEDOUT. It will not notify the server when the port
is released, causing the server port remain.
when client's vsock_connect timeout,it should check sk state is
ESTABLISHED or not. if sk state is ESTABLISHED, it means the connection
is established, the client should not set the sk state to CLOSE

Note: I encountered this issue on kernel-4.18, which can be fixed by
this patch. Then I checked the latest code in the community
and found similar issue.

Fixes: d021c34405 ("VSOCK: Introduce VM Sockets")
Signed-off-by: Zhuang Shengen <zhuangshengen@huawei.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-24 17:36:49 +01:00
..
Kconfig
Makefile
af_vsock.c vsock: avoid to close connected socket after the timeout 2023-05-24 17:36:49 +01:00
af_vsock_tap.c
diag.c
hyperv_transport.c Drivers: hv: vmbus: Copy packets sent by Hyper-V out of the ring buffer 2021-05-14 17:37:46 +00:00
virtio_transport.c vsock/virtio: enable VQs early on probe 2022-04-08 14:23:51 +02:00
virtio_transport_common.c vhost/vsock: Use kvmalloc/kvfree for larger packets. 2022-10-26 12:34:47 +02:00
vmci_transport.c net: vmw_vsock: vmci: Check memcpy_from_msg() 2022-12-31 13:14:18 +01:00
vmci_transport.h
vmci_transport_notify.c
vmci_transport_notify.h
vmci_transport_notify_qstate.c
vsock_addr.c
vsock_loopback.c vsock/loopback: enable SEQPACKET for transport 2021-06-11 13:32:47 -07:00