diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2019-11-14 10:57:48 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-15 03:12:18 +0100 |
commit | 6a2c0962105ae8ceba182c4f616e0e41d7755591 (patch) | |
tree | eddaccb735a16b747cb7e422c93d2319233e91ba /net/vmw_vsock/hyperv_transport.c | |
parent | vsock/vmci: register vmci_transport only when VMCI guest/host are active (diff) | |
download | linux-6a2c0962105ae8ceba182c4f616e0e41d7755591.tar.xz linux-6a2c0962105ae8ceba182c4f616e0e41d7755591.zip |
vsock: prevent transport modules unloading
This patch adds 'module' member in the 'struct vsock_transport'
in order to get/put the transport module. This prevents the
module unloading while sockets are assigned to it.
We increase the module refcnt when a socket is assigned to a
transport, and we decrease the module refcnt when the socket
is destructed.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/vmw_vsock/hyperv_transport.c')
-rw-r--r-- | net/vmw_vsock/hyperv_transport.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c index 1c9e65d7d94d..3c7d07a99fc5 100644 --- a/net/vmw_vsock/hyperv_transport.c +++ b/net/vmw_vsock/hyperv_transport.c @@ -857,6 +857,8 @@ int hvs_notify_send_post_enqueue(struct vsock_sock *vsk, ssize_t written, } static struct vsock_transport hvs_transport = { + .module = THIS_MODULE, + .get_local_cid = hvs_get_local_cid, .init = hvs_sock_init, |