summaryrefslogtreecommitdiff
path: root/kernel/module.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2010-08-02 14:23:38 +0300
committerTony Lindgren <tony@atomide.com>2010-08-02 14:23:38 +0300
commit055a1b8c9927bc587f293020a54c6cd8e24dfac0 (patch)
treedb7c8d00931180c4896c9e00d2cb506939592cda /kernel/module.c
parent8a6f7e14fc3b3ea911838c3f4ce137cb8a3d134a (diff)
parentf535daed925c2d3c1db06b06a63c4955f2c51988 (diff)
Merge branch 'devel-misc' into omap-for-linus
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 8c6b42840dd1..6c562828c85c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -787,7 +787,6 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
/* Store the name of the last unloaded module for diagnostic purposes */
strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
- ddebug_remove_module(mod->name);
free_module(mod);
return 0;
@@ -1550,6 +1549,9 @@ static void free_module(struct module *mod)
remove_sect_attrs(mod);
mod_kobject_remove(mod);
+ /* Remove dynamic debug info */
+ ddebug_remove_module(mod->name);
+
/* Arch-specific cleanup. */
module_arch_cleanup(mod);
@@ -2062,6 +2064,12 @@ static void dynamic_debug_setup(struct _ddebug *debug, unsigned int num)
#endif
}
+static void dynamic_debug_remove(struct _ddebug *debug)
+{
+ if (debug)
+ ddebug_remove_module(debug->modname);
+}
+
static void *module_alloc_update_bounds(unsigned long size)
{
void *ret = module_alloc(size);
@@ -2124,6 +2132,8 @@ static noinline struct module *load_module(void __user *umod,
void *ptr = NULL; /* Stops spurious gcc warning */
unsigned long symoffs, stroffs, *strmap;
void __percpu *percpu;
+ struct _ddebug *debug = NULL;
+ unsigned int num_debug = 0;
mm_segment_t old_fs;
@@ -2476,15 +2486,9 @@ static noinline struct module *load_module(void __user *umod,
kfree(strmap);
strmap = NULL;
- if (!mod->taints) {
- struct _ddebug *debug;
- unsigned int num_debug;
-
+ if (!mod->taints)
debug = section_objs(hdr, sechdrs, secstrings, "__verbose",
sizeof(*debug), &num_debug);
- if (debug)
- dynamic_debug_setup(debug, num_debug);
- }
err = module_finalize(hdr, sechdrs, mod);
if (err < 0)
@@ -2526,10 +2530,13 @@ static noinline struct module *load_module(void __user *umod,
goto unlock;
}
+ if (debug)
+ dynamic_debug_setup(debug, num_debug);
+
/* Find duplicate symbols */
err = verify_export_symbols(mod);
if (err < 0)
- goto unlock;
+ goto ddebug;
list_add_rcu(&mod->list, &modules);
mutex_unlock(&module_mutex);
@@ -2557,6 +2564,8 @@ static noinline struct module *load_module(void __user *umod,
mutex_lock(&module_mutex);
/* Unlink carefully: kallsyms could be walking list. */
list_del_rcu(&mod->list);
+ ddebug:
+ dynamic_debug_remove(debug);
unlock:
mutex_unlock(&module_mutex);
synchronize_sched();