From: Rusty Russell <rusty@au1.ibm.com>

Vatsa spotted this: you can remove a module while it's being initialized,
and that will be bad.  Hole was opened when I dropped the sem around the
init routine (which can probe for other modules).



 kernel/module.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -puN kernel/module.c~rmmod-race-fix kernel/module.c
--- 25/kernel/module.c~rmmod-race-fix	2004-01-04 01:28:30.000000000 -0800
+++ 25-akpm/kernel/module.c	2004-01-04 01:28:30.000000000 -0800
@@ -687,8 +687,8 @@ sys_delete_module(const char __user *nam
 		goto out;
 	}
 
-	/* Already dying? */
-	if (mod->state == MODULE_STATE_GOING) {
+	/* Doing init or already dying? */
+	if (mod->state != MODULE_STATE_LIVE) {
 		/* FIXME: if (force), slam module count and wake up
                    waiter --RR */
 		DEBUGP("%s already dying\n", mod->name);

_