Follow vhost's vhost_vsock_reset_orphans() and VMCI's
vmci_transport_handle_detach(): set SHUTDOWN_MASK, which will come handy
later in the series.

Note that commit c38f57da428b ("vhost/vsock: fix reset orphans race with
close timeout") fixed a race between pending close timer, i.e.
virtio_transport_close_timeout(), and a transport/PM reset. But here we
never set SOCK_DONE, hence no race.

Fixes: 0ea9e1d3a9e3 ("VSOCK: Introduce virtio_transport.ko")
Signed-off-by: Michal Luczaj <[email protected]>
---
 net/vmw_vsock/virtio_transport.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
index 4f9aa9c4c3aa..4d6991321699 100644
--- a/net/vmw_vsock/virtio_transport.c
+++ b/net/vmw_vsock/virtio_transport.c
@@ -413,11 +413,14 @@ static void virtio_vsock_event_fill(struct virtio_vsock 
*vsock)
 
 static void virtio_vsock_reset_sock(struct sock *sk)
 {
+       struct vsock_sock *vsk = vsock_sk(sk);
+
        /* vmci_transport.c doesn't take sk_lock here either.  At least we're
         * under vsock_table_lock so the sock cannot disappear while we're
         * executing.
         */
 
+       vsk->peer_shutdown = SHUTDOWN_MASK;
        sk->sk_state = TCP_CLOSE;
        sk->sk_err = ECONNRESET;
        sk_error_report(sk);

-- 
2.55.0


Reply via email to