Re: [PATCH net v2] vsock: only undo SS_CONNECTING when connect() fails

From: Michal Luczaj

Date: Wed Nov 25 2026 - 15:26:39 EST


On 11/24/26 21:42, Bobby Eshleman wrote:
> On Tue, Nov 24, 2026 at 05:17:56PM +0100, Michal Luczaj wrote:
>> On 11/24/26 00:19, Bobby Eshleman wrote:
>>> On Sat, Nov 21, 2026 at 07:32:15PM +0100, Michal Luczaj wrote:
>
> [...]
>
>>> So the attempt never times out, and a late OP_RESPONSE connects a
>>> socket the user already shut down, overwriting SS_DISCONNECTING with
>>> SS_CONNECTED. I think that's a separate bug for a separate patch,
>>> though.
>>
>> Great, I'm all in favour of consolidation. So in the scenario above,
>> invoking vsock_connect_close() on vsock_connect_timeout() (with sk_shutdown
>> check dropped) would result in CLOSE/DISCONNECTING, and no more late
>> virtio_transport_recv_connecting(), right?
>
> Right, that late response will fall through and get an RST back. I'm
> not 100% sure yet about how to rework the sk_shutdown check yet
> though. I mention TCP's approach to shutdowns in my reply to Paolo and
> I'm thinking thats probably the right way to go about it, but not 100%
> sure yet...

I just wanted to admit that simply dropping the sk_shutdown check was a bad
idea: vsock_connect_timeout() may outlive vsock_release(), and that check
guards against bad things happening.