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 <[email protected]>
> Link: 
> https://lore.kernel.org/netdev/[email protected]/
> Signed-off-by: Bobby Eshleman <[email protected]>

Reviewed-by: Michal Luczaj <[email protected]>

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/[email protected]/

And there was at least one report off-list, so:
Reported-by: Kyle Zeng <[email protected]>

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.


Reply via email to