This is the patch I just put into my tree (beware cut-n-paste breakage is
in effect, but Linus should have the change in his tree momentarily
anyway):
diff -Nru a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c Sun Nov 17 17:02:48 2002
+++ b/kernel/module.c Sun Nov 17 17:02:48 2002
@@ -1058,6 +1058,15 @@
list_add(&mod->extable.list, &extables);
spin_unlock_irq(&modlist_lock);
+ /* Note, setting the mod->live to 1 here is safe because we haven't
+ * linked the module into the system's kernel symbol table yet,
+ * which means that the only way any other kernel code can call
+ * into this module right now is if this module hands out entry
+ * pointers to the other code. We assume that no module hands out
+ * entry pointers to the rest of the kernel unless it is ready to
+ * have them used.
+ */
+ mod->live = 1;
/* Start the module */
ret = mod->init ? mod->init() : 0;
if (ret < 0) {
@@ -1070,9 +1079,10 @@
/* Mark it "live" so that they can force
deletion later, and we don't keep getting
woken on every decrement. */
- mod->live = 1;
- } else
+ } else {
+ mod->live = 0;
free_module(mod);
+ }
up(&module_mutex);
return ret;
}
@@ -1087,7 +1097,6 @@
mod->module_init = NULL;
/* All ok! */
- mod->live = 1;
up(&module_mutex);
return 0;
}
-- Doug Ledford <dledford@redhat.com> 919-754-3700 x44233 Red Hat, Inc. 1801 Varsity Dr. Raleigh, NC 27606 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/