diff options
| author | Doug Ledford <dledford@aladin.rdu.redhat.com> | 2002-11-17 06:38:02 -0500 |
|---|---|---|
| committer | Doug Ledford <dledford@aladin.rdu.redhat.com> | 2002-11-17 06:38:02 -0500 |
| commit | f9da8a748fb2cd6ef50b974c65b000b163c4a67c (patch) | |
| tree | b4e5100c9b97c5153583349f137d5089db931aed /kernel | |
| parent | f6c8e663e9fdfedde09f3a623fbb0518eb566d40 (diff) | |
| parent | d00819951546acddaece9b76f7124db8c70e95eb (diff) | |
Merge aladin.rdu.redhat.com:/usr/local/home/dledford/bk/linus-2.5
into aladin.rdu.redhat.com:/usr/src/2.5
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/module.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/module.c b/kernel/module.c index 9d998fd9cf07..920cc7b184af 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1098,6 +1098,15 @@ sys_init_module(void *umod, 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) { @@ -1110,9 +1119,10 @@ sys_init_module(void *umod, /* 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; } @@ -1127,7 +1137,6 @@ sys_init_module(void *umod, mod->module_init = NULL; /* All ok! */ - mod->live = 1; up(&module_mutex); return 0; } |
