Re: [PATCH v5 3/3] vsock: use sock_error() to consume sk_err after a failed connect

Stefano Garzarella <[email protected]>
Newsgroups org.kernel.vger.netdev,dev.linux.lists.virtualization,org.kernel.vger.linux-kernel
Message-ID <an17EsASX_Nn8wxi@sgarzare-redhat>
On Tue, Aug 11, 2026 at 01:09:32AM +0800, Nguyen Dinh Phi wrote:
>vsock_connect() returns sk_err to userspace but does not clear it:
>  if (sk->sk_err) {
>            err = -sk->sk_err;
>
>For a blocking connect() the error has already been delivered as
>connect()'s return value, so leaving it set causes subsequent operations
>like poll()/epoll() to keep reporting POLLERR even though the connect
>failure was already delivered.
>
>The error should be consumed once it has been returned to userspace.
>Switch to sock_error(), which reads and clears sk_err atomically,
>matching the behavior of other protocol implementations such as
>__inet_stream_connect().
>
>Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
>Tested-by: Wupeng Ma <[email protected]>
>Signed-off-by: Nguyen Dinh Phi <[email protected]>
>---
> net/vmw_vsock/af_vsock.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Stefano Garzarella <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.