Skip to content

Commit

Permalink
VSOCK: make af_vsock.ko removable again
Browse files Browse the repository at this point in the history
Commit c1eef22 ("vsock: always call
vsock_init_tables()") introduced a module_init() function without a
corresponding module_exit() function.

Modules with an init function can only be removed if they also have an
exit function.  Therefore the vsock module was considered "permanent"
and could not be removed.

This patch adds an empty module_exit() function so that "rmmod vsock"
works.  No explicit cleanup is required because:

1. Transports call vsock_core_exit() upon exit and cannot be removed
   while sockets are still alive.
2. vsock_diag.ko does not perform any action that requires cleanup by
   vsock.ko.

Fixes: c1eef22 ("vsock: always call vsock_init_tables()")
Reported-by: Xiumei Mu <[email protected]>
Cc: Cong Wang <[email protected]>
Cc: Jorgen Hansen <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Jorgen Hansen <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
stefanhaRH authored and davem330 committed Apr 17, 2018
1 parent 5968a70 commit 05e489b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/vmw_vsock/af_vsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,13 @@ const struct vsock_transport *vsock_core_get_transport(void)
}
EXPORT_SYMBOL_GPL(vsock_core_get_transport);

static void __exit vsock_exit(void)
{
/* Do nothing. This function makes this module removable. */
}

module_init(vsock_init_tables);
module_exit(vsock_exit);

MODULE_AUTHOR("VMware, Inc.");
MODULE_DESCRIPTION("VMware Virtual Socket Family");
Expand Down

0 comments on commit 05e489b

Please sign in to comment.