From: corbet@lwn.net (Jonathan Corbet)
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] Allow arbitrary number of init funcs in modules
Date: Mon, 23 Jun 2003 13:11:41 -0600 [thread overview]
Message-ID: <20030623191141.31814.qmail@eklektix.com> (raw)
In-Reply-To: Your message of "Mon, 23 Jun 2003 19:19:48 +1000." <20030623092028.2B5272C2FC@lists.samba.org>
> Feedback is extremely welcome,
OK...you asked for it. I found three separate bugs, two of them oopsed the
system, and the other prevented module unloading. Did you try it with
CONFIG_MODULE_UNLOAD? :) You also need to test for null init functions,
because the module_init/module_exit mode creates them. Patch appended.
Also...some guy once posted (http://lwn.net/Articles/22763/):
I appeciate the series in modernizing modules, but just FYI, I
don't think the old-style init_module/cleanup_module stuff will
break any time soon: there are still a large number of drivers
which use it, and there's not much point making such changes.
This patch breaks the old init_module/cleanup_module scheme; those
functions no longer get called. Was that intentional?
jon
P.S. Beyond that, I think the patch makes sense :)
Jonathan Corbet
Executive editor, LWN.net
corbet@lwn.net
--- 2.5.73-rr/kernel/module.c Tue Jun 24 02:58:32 2003
+++ 2.5.73/kernel/module.c Tue Jun 24 03:00:36 2003
@@ -617,9 +617,10 @@
{
int i, balance = 0;
- for (i = 0; i < num_pairs; i++)
+ for (i = 0; i < num_pairs; i++) {
balance += (pairs->init ? 1 : 0) - (pairs->exit ? 1 : 0);
-
+ pairs++;
+ }
return balance == 0;
}
@@ -643,7 +644,7 @@
{
struct module *mod;
char name[MODULE_NAME_LEN];
- unsigned int i;
+ int i;
int ret, forced = 0;
if (!capable(CAP_SYS_MODULE))
@@ -1725,6 +1726,8 @@
/* Start the module */
for (i = 0; i < mod->num_ie_pairs; i++) {
+ if (mod->ie_pairs[i].init == NULL)
+ continue;
ret = mod->ie_pairs[i].init();
if (ret != 0) {
DEBUGP("%s: init/exit pair init=%p failed: %i\n",
next prev parent reply other threads:[~2003-06-23 18:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-23 9:19 Rusty Russell
2003-06-23 19:11 ` Jonathan Corbet [this message]
2003-06-24 2:29 ` Rusty Russell
2003-06-24 6:57 ` Rusty Russell
2003-06-24 20:06 ` Horst von Brand
2003-06-24 17:01 ` Roman Zippel
2003-06-25 3:10 ` Rusty Russell
2003-06-25 10:30 ` Roman Zippel
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=20030623191141.31814.qmail@eklektix.com \
--to=corbet@lwn.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/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
all inboxes | Powered by JetHome®