> Transport events are serviced by resetting each connected socket. The reset
> is done under vsock_table_lock but without taking lock_sock(), so from the
> point of view of vsock_connect() - locklessly. The same pattern is present
> in virtio_vsock_reset_sock(), vmci_transport_handle_detach() and
> vhost_vsock_reset_orphans().
> 
> While connect() waits for TCP_SYN_SENT -> TCP_ESTABLISHED, other
> transitions can also occur:
> 
>   TCP_SYN_SENT -> TCP_CLOSE on connection failure, timeout or signal
>   TCP_SYN_SENT -> TCP_ESTABLISHED -> TCP_CLOSING on VIRTIO_VSOCK_OP_RST
>   TCP_SYN_SENT -> TCP_ESTABLISHED -> [TCP_CLOSING ->] TCP_CLOSE on event
> 
> But transport events leave SS_CONNECTED state unchanged. So take a note of
> that, rather than a) making every event handler drop the socket from
> connected_table, or b) adapting connect() to handle more transitions (while
> missing proper locking).
> 
> Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
> Signed-off-by: Michal Luczaj <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=6


Reply via email to