• Dexuan Cui's avatar
    hv_sock: add locking in the open/close/release code paths · b4562ca7
    Dexuan Cui authored
    Without the patch, when hvs_open_connection() hasn't completely established
    a connection (e.g. it has changed sk->sk_state to SS_CONNECTED, but hasn't
    inserted the sock into the connected queue), vsock_stream_connect() may see
    the sk_state change and return the connection to the userspace, and next
    when the userspace closes the connection quickly, hvs_release() may not see
    the connection in the connected queue; finally hvs_open_connection()
    inserts the connection into the queue, but we won't be able to purge the
    connection for ever.
    Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
    Cc: K. Y. Srinivasan <kys@microsoft.com>
    Cc: Haiyang Zhang <haiyangz@microsoft.com>
    Cc: Stephen Hemminger <sthemmin@microsoft.com>
    Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
    Cc: Cathy Avery <cavery@redhat.com>
    Cc: Rolf Neugebauer <rolf.neugebauer@docker.com>
    Cc: Marcelo Cerri <marcelo.cerri@canonical.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b4562ca7
hyperv_transport.c 22.4 KB