diff options
| author | Rusty Russell <rusty@rustcorp.com.au> | 2002-12-27 08:09:36 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-12-27 08:09:36 -0800 |
| commit | 58acbf381481df951fc05b1084b5f4b79540357a (patch) | |
| tree | e7360a6e079155fe64054b4b454485770bce6b34 /kernel/module.c | |
| parent | 30c9bd1ac7188c812f3d6711a412ce0bea9a2e78 (diff) | |
[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).
Diffstat (limited to 'kernel/module.c')
| -rw-r--r-- | kernel/module.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/module.c b/kernel/module.c index c73b19336f1e..2209ab07e733 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -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"); |
