Centos-kernel-stream-9/net/vmw_vsock
Stefano Garzarella 0e013b6bf8 virtio/vsock: fix the transport to work with VMADDR_CID_ANY
Bugzilla: http://bugzilla.redhat.com/2026949

commit 1db8f5fc2e5c66a5c51e1f6488e0ba7d45c29ae4
Author: Wei Wang <wei.w.wang@intel.com>
Date:   Thu Nov 25 20:18:23 2021 -0500

    virtio/vsock: fix the transport to work with VMADDR_CID_ANY

    The VMADDR_CID_ANY flag used by a socket means that the socket isn't bound
    to any specific CID. For example, a host vsock server may want to be bound
    with VMADDR_CID_ANY, so that a guest vsock client can connect to the host
    server with CID=VMADDR_CID_HOST (i.e. 2), and meanwhile, a host vsock
    client can connect to the same local server with CID=VMADDR_CID_LOCAL
    (i.e. 1).

    The current implementation sets the destination socket's svm_cid to a
    fixed CID value after the first client's connection, which isn't an
    expected operation. For example, if the guest client first connects to the
    host server, the server's svm_cid gets set to VMADDR_CID_HOST, then other
    host clients won't be able to connect to the server anymore.

    Reproduce steps:
    1. Run the host server:
       socat VSOCK-LISTEN:1234,fork -
    2. Run a guest client to connect to the host server:
       socat - VSOCK-CONNECT:2:1234
    3. Run a host client to connect to the host server:
       socat - VSOCK-CONNECT:1:1234

    Without this patch, step 3. above fails to connect, and socat complains
    "socat[1720] E connect(5, AF=40 cid:1 port:1234, 16): Connection
    reset by peer".
    With this patch, the above works well.

    Fixes: c0cfa2d8a7 ("vsock: add multi-transports support")
    Signed-off-by: Wei Wang <wei.w.wang@intel.com>
    Link: https://lore.kernel.org/r/20211126011823.1760-1-wei.w.wang@intel.com
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2021-12-21 08:56:12 +01:00
..
Kconfig
Makefile
af_vsock.c vsock: prevent unnecessary refcnt inc for nonblocking connect 2021-12-21 08:56:12 +01:00
af_vsock_tap.c
diag.c
hyperv_transport.c
virtio_transport.c vsock/virtio: avoid potential deadlock when vsock device remove 2021-08-12 10:57:27 -07:00
virtio_transport_common.c virtio/vsock: fix the transport to work with VMADDR_CID_ANY 2021-12-21 08:56:12 +01:00
vmci_transport.c net: sock: introduce sk_error_report 2021-06-29 11:28:21 -07:00
vmci_transport.h
vmci_transport_notify.c
vmci_transport_notify.h
vmci_transport_notify_qstate.c
vsock_addr.c
vsock_loopback.c vsock/loopback: enable SEQPACKET for transport 2021-06-11 13:32:47 -07:00