Commit aa388c72 authored by Michal Luczaj's avatar Michal Luczaj Committed by Jakub Kicinski
Browse files

vsock: Allow retrying on connect() failure



sk_err is set when a (connectible) connect() fails. Effectively, this makes
an otherwise still healthy SS_UNCONNECTED socket impossible to use for any
subsequent connection attempts.

Clear sk_err upon trying to establish a connection.

Fixes: d021c344 ("VSOCK: Introduce VM Sockets")
Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
Reviewed-by: default avatarLuigi Leonardi <leonardi@redhat.com>
Signed-off-by: default avatarMichal Luczaj <mhal@rbox.co>
Link: https://patch.msgid.link/20250128-vsock-transport-vs-autobind-v3-2-1cf57065b770@rbox.co


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent fcdd2242
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1523,6 +1523,11 @@ static int vsock_connect(struct socket *sock, struct sockaddr *addr,
		if (err < 0)
			goto out;

		/* sk_err might have been set as a result of an earlier
		 * (failed) connect attempt.
		 */
		sk->sk_err = 0;

		/* Mark sock as connecting and set the error code to in
		 * progress in case this is a non-blocking connect.
		 */