All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] VSOCK: make af_vsock.ko removable again
@ 2018-04-17  6:25 Stefan Hajnoczi
  2018-04-17  8:30 ` Jorgen S. Hansen
  2018-04-17 13:45 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2018-04-17  6:25 UTC (permalink / raw)
  To: netdev; +Cc: Stefan Hajnoczi, Cong Wang, Jorgen Hansen

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.

Reported-by: Xiumei Mu <xmu@redhat.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 net/vmw_vsock/af_vsock.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index aac9b8f6552e..c1076c19b858 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -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");
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] VSOCK: make af_vsock.ko removable again
  2018-04-17  6:25 [PATCH] VSOCK: make af_vsock.ko removable again Stefan Hajnoczi
@ 2018-04-17  8:30 ` Jorgen S. Hansen
  2018-04-17 13:45 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Jorgen S. Hansen @ 2018-04-17  8:30 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: netdev, Cong Wang


> On Apr 17, 2018, at 8:25 AM, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> 
> 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.
> 
> Reported-by: Xiumei Mu <xmu@redhat.com>
> Cc: Cong Wang <xiyou.wangcong@gmail.com>
> Cc: Jorgen Hansen <jhansen@vmware.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> net/vmw_vsock/af_vsock.c | 6 ++++++
> 1 file changed, 6 insertions(+)
> 
> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
> index aac9b8f6552e..c1076c19b858 100644
> --- a/net/vmw_vsock/af_vsock.c
> +++ b/net/vmw_vsock/af_vsock.c
> @@ -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");
> -- 
> 2.14.3
> 

Looks good to me.

Reviewed-by: Jorgen Hansen <jhansen@vmware.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] VSOCK: make af_vsock.ko removable again
  2018-04-17  6:25 [PATCH] VSOCK: make af_vsock.ko removable again Stefan Hajnoczi
  2018-04-17  8:30 ` Jorgen S. Hansen
@ 2018-04-17 13:45 ` David Miller
  2018-04-18  4:14   ` Stefan Hajnoczi
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2018-04-17 13:45 UTC (permalink / raw)
  To: stefanha; +Cc: netdev, xiyou.wangcong, jhansen

From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue, 17 Apr 2018 14:25:58 +0800

> 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.
> 
> Reported-by: Xiumei Mu <xmu@redhat.com>
> Cc: Cong Wang <xiyou.wangcong@gmail.com>
> Cc: Jorgen Hansen <jhansen@vmware.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Applied, but please provide a proper Fixes: tag next time.  I added it
for you this time.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] VSOCK: make af_vsock.ko removable again
  2018-04-17 13:45 ` David Miller
@ 2018-04-18  4:14   ` Stefan Hajnoczi
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2018-04-18  4:14 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, xiyou.wangcong, jhansen

[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]

On Tue, Apr 17, 2018 at 09:45:12AM -0400, David Miller wrote:
> From: Stefan Hajnoczi <stefanha@redhat.com>
> Date: Tue, 17 Apr 2018 14:25:58 +0800
> 
> > 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.
> > 
> > Reported-by: Xiumei Mu <xmu@redhat.com>
> > Cc: Cong Wang <xiyou.wangcong@gmail.com>
> > Cc: Jorgen Hansen <jhansen@vmware.com>
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> Applied, but please provide a proper Fixes: tag next time.  I added it
> for you this time.

Will do.  Thanks!

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-18  4:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17  6:25 [PATCH] VSOCK: make af_vsock.ko removable again Stefan Hajnoczi
2018-04-17  8:30 ` Jorgen S. Hansen
2018-04-17 13:45 ` David Miller
2018-04-18  4:14   ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.