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 /include/net/af_vsock.h | |
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 'include/net/af_vsock.h')
-rw-r--r-- | include/net/af_vsock.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h index cf5c3691251b..4206dc6d813f 100644 --- a/include/net/af_vsock.h +++ b/include/net/af_vsock.h @@ -100,6 +100,8 @@ struct vsock_transport_send_notify_data { #define VSOCK_TRANSPORT_F_DGRAM 0x00000004 struct vsock_transport { + struct module *module; + /* Initialize/tear-down socket. */ int (*init)(struct vsock_sock *, struct vsock_sock *); void (*destruct)(struct vsock_sock *); |