diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2019-11-14 12:57:48 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-15 05:12:18 +0300 |
commit | 6a2c0962105ae8ceba182c4f616e0e41d7755591 (patch) | |
tree | eddaccb735a16b747cb7e422c93d2319233e91ba /drivers/vhost/vsock.c | |
parent | b1bba80a4376aef34de2b57bfb8834bd095703ed (diff) | |
download | linux-6a2c0962105ae8ceba182c4f616e0e41d7755591.tar.xz |
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 'drivers/vhost/vsock.c')
-rw-r--r-- | drivers/vhost/vsock.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index b235f4bbe8ea..fdda9ec625ad 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -386,6 +386,8 @@ static bool vhost_vsock_more_replies(struct vhost_vsock *vsock) static struct virtio_transport vhost_transport = { .transport = { + .module = THIS_MODULE, + .get_local_cid = vhost_transport_get_local_cid, .init = virtio_transport_do_socket_init, |