public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Overzealous permenant mark removed
Date: Fri, 27 Dec 2002 19:44:41 +1100	[thread overview]
Message-ID: <20021227084936.1DCBD2C10B@lists.samba.org> (raw)

Linus, please apply.

Name: Modules without init functions don't need exit functions
Author: Rusty Russell
Status: Trivial

D: If modules don't use module_exit(), they cannot be unloaded.  This
D: safety mechanism should not apply for modules which don't use
D: module_init() (implying they have nothing to clean up anyway).

diff -urNp --exclude TAGS -X /home/rusty/current-dontdiff --minimal linux-2.5.52/kernel/module.c working-2.5.52-noexit/kernel/module.c
--- linux-2.5.52/kernel/module.c	Tue Dec 17 08:11:03 2002
+++ working-2.5.52-noexit/kernel/module.c	Mon Dec 23 11:26:36 2002
@@ -405,7 +405,8 @@ sys_delete_module(const char *name_user,
 		}
 	}
 
-	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
 	if (mod->unsafe)
 		seq_printf(m, " [unsafe]");
 
-	if (!mod->exit)
+	if (mod->init && !mod->exit)
 		seq_printf(m, " [permanent]");
 
 	seq_printf(m, "\n");

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

             reply	other threads:[~2002-12-27  8:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-27  8:44 Rusty Russell [this message]
2002-12-30 11:40 ` [PATCH] Overzealous permenant mark removed Dave Jones
2002-12-31  6:55   ` Rusty Russell
2002-12-31  7:17     ` Linus Torvalds
2002-12-31  7:56       ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021227084936.1DCBD2C10B@lists.samba.org \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox