VSOCK: make af_vsock.ko removable again
Subsystems (3)
PATCH 1/1 VSOCK: make af_vsock.ko removable again
Commit c1eef220c1760762753b602c382127bfccee226d ("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.
--- net/vmw_vsock/af_vsock.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/vmw_vsock/af_vsock.c +6 -0
@@ -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" );
Signature · 1 line
2.14.3
Quoted 48 lines · Stefan Hajnoczi
Commit
c1eef220c1760762753b602c382127bfccee226d("vsock: always callvsock_init_tables()") introduced amodule_init()function without a correspondingmodule_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.Reported-by Xiumei Mu <[email protected]>Cc Cong Wang <[email protected]>Cc Jorgen Hansen <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>---
net/vmw_vsock/af_vsock.c| 6 ++++++1 file changed, 6 insertions(+)net/vmw_vsock/af_vsock.c +6
-0@@ -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" );Signature · 1 line
2.14.3
Looks good to me.
From: Stefan Hajnoczi <[email protected]>
Date: Tue, 17 Apr 2018 14:25:58 +0800
Quoted 16 lines
Commit
c1eef220c1760762753b602c382127bfccee226d("vsock: always callvsock_init_tables()") introduced amodule_init()function without a correspondingmodule_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.
Quoted 4 lines
Reported-by Xiumei Mu <[email protected]>Cc Cong Wang <[email protected]>Cc Jorgen Hansen <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>
Applied, but please provide a proper Fixes: tag next time. I added it for you this time.
Quoted 19 lines · David Miller
From: Stefan Hajnoczi <[email protected]>
Date: Tue, 17 Apr 2018 14:25:58 +0800Quoted 16 lines
Commit
c1eef220c1760762753b602c382127bfccee226d("vsock: always callvsock_init_tables()") introduced amodule_init()function without a correspondingmodule_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.
Quoted 7 lines
Quoted 4 lines
Reported-by Xiumei Mu <[email protected]>Cc Cong Wang <[email protected]>Cc Jorgen Hansen <[email protected]>Signed-off-by Stefan Hajnoczi <[email protected]>Applied, but please provide a proper Fixes: tag next time. I added it for you this time.
Will do. Thanks!
Stefan