mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 04:04:06 +00:00
vsock: Set socket state back to SS_UNCONNECTED in vsock_connect_timeout()
commita3e7b29e30
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>
This commit is contained in:
parent
e604d3b763
commit
277baed598
1 changed files with 1 additions and 0 deletions
|
@ -1285,6 +1285,7 @@ static void vsock_connect_timeout(struct work_struct *work)
|
|||
if (sk->sk_state == TCP_SYN_SENT &&
|
||||
(sk->sk_shutdown != SHUTDOWN_MASK)) {
|
||||
sk->sk_state = TCP_CLOSE;
|
||||
sk->sk_socket->state = SS_UNCONNECTED;
|
||||
sk->sk_err = ETIMEDOUT;
|
||||
sk_error_report(sk);
|
||||
vsock_transport_cancel_pkt(vsk);
|
||||
|
|
Loading…
Add table
Reference in a new issue