From: Michal Luczaj <mhal@rbox.co>
To: "Bobby Eshleman" <bobbyeshleman@meta.com>,
"Stefano Garzarella" <sgarzare@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowangio@gmail.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Shuah Khan" <shuah@kernel.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Donald Hunter" <donald.hunter@gmail.com>,
"Eric Dumazet" <edumazet@kernel.org>,
"George Zhang" <georgezhang@vmware.com>,
"Andy King" <acking@vmware.com>,
"Dmitry Torokhov" <dtor@vmware.com>
Cc: virtualization@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
sargun@sargun.me, jlinbox@meta.com,
Bobby Eshleman <bobbyeshleman@gmail.com>
Subject: Re: [PATCH net-next v6 1/8] vsock: only undo SS_CONNECTING when connect() fails
Date: Mon, 16 Nov 2026 00:10:19 +0100 [thread overview]
Message-ID: <6bdfe6f7-aba8-4fb8-ac24-62fe020e1422@rbox.co> (raw)
In-Reply-To: <20261113-vsock-guest-ns-v6-1-3737ce4673c0@meta.com>
On 11/14/26 04:14, Bobby Eshleman wrote:
> vsock_connect() sleeps with the socket unlocked. Meanwhile the transport
> can complete the handshake, setting sock->state to SS_CONNECTED, and then
> reset the connection, e.g. in vhost_vsock_reset_orphans(),
> virtio_vsock_reset_sock() or vmci_transport_handle_detach(). When
> connect() gets the lock back, it finds sk_err set and moves the socket
> back to SS_UNCONNECTED. Userspace can then connect() the socket again,
> and a connect() to a CID on another transport makes
> vsock_assign_transport() release the transport the socket was connected
> on.
>
> Only move the socket back to SS_UNCONNECTED if it is still
> SS_CONNECTING. A socket that got connected stays SS_CONNECTED, and
> another connect() fails with -EISCONN.
>
> Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
> Suggested-by: Michal Luczaj <mhal@rbox.co>
> Link: https://lore.kernel.org/netdev/179447093204.2199510.8895677421994612994@kernel.org/
> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com>
Reviewed-by: Michal Luczaj <mhal@rbox.co>
Thanks! To be precise, the Link: above is more of Sashiko's musings on
what's wrong with Jerome's (not merged) patch. The patch of yours makes it
moot.
I believe the first time lore mentions the issue at hand:
Link:
https://lore.kernel.org/netdev/20260909-vsock-connect-reset-closing-v1-1-50298b9ccfbf@rbox.co/
And there was at least one report off-list, so:
Reported-by: Kyle Zeng <kylebot@openai.com>
BTW, I've noticed Sashiko already commented on this patch. I feel I'm
responsible for that wall of text, so I took the liberty to reply. Hope
this will help.
next prev parent reply other threads:[~2026-11-15 23:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 3:14 [PATCH net-next v6 0/8] vsock: assign the guest vsock device to a network namespace Bobby Eshleman
2026-11-14 3:14 ` [PATCH net-next v6 1/8] vsock: only undo SS_CONNECTING when connect() fails Bobby Eshleman
2026-11-15 4:01 ` netdev-bot+sashiko
2026-11-15 23:11 ` Michal Luczaj
2026-11-15 23:10 ` Michal Luczaj [this message]
2026-11-14 3:14 ` [PATCH net-next v6 2/8] vsock: constify the transport in vsock_for_each_connected_socket() Bobby Eshleman
2026-11-14 3:14 ` [PATCH net-next v6 3/8] vsock: rename the vsock pernet operations Bobby Eshleman
2026-11-14 3:14 ` [PATCH net-next v6 4/8] vsock: pass the netns to ->has_remote_cid() Bobby Eshleman
2026-11-14 3:14 ` [PATCH net-next v6 5/8] vsock: add a netlink command to assign the g2h device to a netns Bobby Eshleman
2026-11-15 4:01 ` netdev-bot+sashiko
2026-11-15 22:31 ` Bobby Eshleman
2026-11-14 3:14 ` [PATCH net-next v6 6/8] vsock/virtio: support guest device network namespace Bobby Eshleman
2026-11-15 4:01 ` netdev-bot+sashiko
2026-11-14 3:14 ` [PATCH net-next v6 7/8] selftests/vsock: test the guest vsock " Bobby Eshleman
2026-11-15 4:01 ` netdev-bot+sashiko
2026-11-14 3:14 ` [PATCH net-next v6 8/8] selftests/vsock: test the netns assign privilege checks Bobby Eshleman
2026-11-15 4:01 ` netdev-bot+sashiko
2026-11-14 3:22 ` [PATCH net-next v6 0/8] vsock: assign the guest vsock device to a network namespace netdev-bot+sinfo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6bdfe6f7-aba8-4fb8-ac24-62fe020e1422@rbox.co \
--to=mhal@rbox.co \
--cc=acking@vmware.com \
--cc=bobbyeshleman@gmail.com \
--cc=bobbyeshleman@meta.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=dtor@vmware.com \
--cc=edumazet@kernel.org \
--cc=eperezma@redhat.com \
--cc=georgezhang@vmware.com \
--cc=horms@kernel.org \
--cc=jasowangio@gmail.com \
--cc=jlinbox@meta.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
--cc=sargun@sargun.me \
--cc=sgarzare@redhat.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®