Handle racy socket changes in connect(). v3 is taking a different approach by turning transport assignment on its head: instead of trying to preserve the transport between failed connect()s, drop it from an _unconnected_ socket as soon as possible, i.e. when something goes wrong with the init or binding, connection fails, time outs or is interrupted by a signal. IOW, route the failure paths of vsock_connect() and vsock_connect_timeout() through one point, replacing the open coded state rollback. Starting from there, corner cases are handled, invariant enforced.
What's perhaps more important, the bug fixes themselves do not touch the driver code and do not introduce lockless writes. --- Changes in v3: - Change the transport assignment life cycle (Stafano) - Expand comments (Stafano) - CC: drop bouncing address - Link to v2: https://patch.msgid.link/[email protected] Changes in v2: - CC: drop bouncing addresses - Add more related fixes - Handle ENOBUFS (Bobby) - Consume sk_err (Stefano) - Link to v1: https://patch.msgid.link/[email protected] --- Michal Luczaj (8): vhost/vsock: Fix socket state constant vsock: simplify error check condition vsock: do not preserve transport assignment vsock: drop the re-assignment logic vsock: treat TCP_CLOSING as once-established vsock: handle socket bricking due to transport event vsock: handle listen() racing connect() vsock: enforce no-transport invariant for TCP_LISTEN sockets drivers/vhost/vsock.c | 2 +- net/vmw_vsock/af_vsock.c | 142 +++++++++++++++++++++++++++-------------------- 2 files changed, 82 insertions(+), 62 deletions(-) --- base-commit: 23d42b9a3bcd55b17d3b371544fedc708c2397e9 change-id: 20260820-vsock-connect-reset-closing-98dd28769d7f Best regards, -- Michal Luczaj <[email protected]>

