linux-stable/net/vmw_vsock
Peilin Ye 52d8f48f85 vsock: Set socket state back to SS_UNCONNECTED in vsock_connect_timeout()
commit a3e7b29e30 upstream.

Imagine two non-blocking vsock_connect() requests on the same socket.
The first request schedules @connect_work, and after it times out,
vsock_connect_timeout() sets *sock* state back to TCP_CLOSE, but keeps
*socket* state as SS_CONNECTING.

Later, the second request returns -EALREADY, meaning the socket "already
has a pending connection in progress", even though the first request has
already timed out.

As suggested by Stefano, fix it by setting *socket* state back to
SS_UNCONNECTED, so that the second request will return -ETIMEDOUT.

Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
Fixes: d021c34405 ("VSOCK: Introduce VM Sockets")
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-25 11:40:11 +02:00
..
af_vsock.c vsock: Set socket state back to SS_UNCONNECTED in vsock_connect_timeout() 2022-08-25 11:40:11 +02: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
Kconfig
Makefile
virtio_transport.c vsock/virtio: enable VQs early on probe 2022-04-08 14:23:51 +02:00
virtio_transport_common.c virtio/vsock: fix the transport to work with VMADDR_CID_ANY 2021-12-22 09:32:39 +01:00
vmci_transport.c vsock: each transport cycles only on its own sockets 2022-03-23 09:16:41 +01:00
vmci_transport.h
vmci_transport_notify.c
vmci_transport_notify.h
vmci_transport_notify_qstate.c
vsock_addr.c vsock_addr: Check for supported flag values 2020-12-14 19:33:39 -08:00
vsock_loopback.c vsock/loopback: enable SEQPACKET for transport 2021-06-11 13:32:47 -07:00