Commit 58acbf38 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Modules without init functions don't need exit functions

If modules don't use module_exit(), they cannot be unloaded.  This
safety mechanism should not apply for modules which don't use
module_init() (implying they have nothing to clean up anyway).
parent 30c9bd1a
......@@ -405,7 +405,8 @@ sys_delete_module(const char *name_user, unsigned int flags)
}
}
if (!mod->exit || mod->unsafe) {
/* If it has an init func, it must have an exit func to unload */
if ((mod->init && !mod->exit) || mod->unsafe) {
forced = try_force(flags);
if (!forced) {
/* This module can't be removed */
......@@ -473,7 +474,7 @@ static void print_unload_info(struct seq_file *m, struct module *mod)
if (mod->unsafe)
seq_printf(m, " [unsafe]");
if (!mod->exit)
if (mod->init && !mod->exit)
seq_printf(m, " [permanent]");
seq_printf(m, "\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment