aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-08-04 09:14:38 -0400
committerJiri Kosina <jkosina@suse.cz>2010-08-04 09:14:38 -0400
commitd790d4d583aeaed9fc6f8a9f4d9f8ce6b1c15c7f (patch)
tree854ab394486288d40fa8179cbfaf66e8bdc44b0f /kernel/module.c
parent73b2c7165b76b20eb1290e7efebc33cfd21db1ca (diff)
parent3a09b1be53d23df780a0cd0e4087a05e2ca4a00c (diff)
Merge branch 'master' into for-next
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,
787 787
788 /* Store the name of the last unloaded module for diagnostic purposes */ 788 /* Store the name of the last unloaded module for diagnostic purposes */
789 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); 789 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
790 ddebug_remove_module(mod->name);
791 790
792 free_module(mod); 791 free_module(mod);
793 return 0; 792 return 0;
@@ -1550,6 +1549,9 @@ static void free_module(struct module *mod)
1550 remove_sect_attrs(mod); 1549 remove_sect_attrs(mod);
1551 mod_kobject_remove(mod); 1550 mod_kobject_remove(mod);
1552 1551
1552 /* Remove dynamic debug info */
1553 ddebug_remove_module(mod->name);
1554
1553 /* Arch-specific cleanup. */ 1555 /* Arch-specific cleanup. */
1554 module_arch_cleanup(mod); 1556 module_arch_cleanup(mod);
1555 1557
@@ -2062,6 +2064,12 @@ static void dynamic_debug_setup(struct _ddebug *debug, unsigned int num)
2062#endif 2064#endif
2063} 2065}
2064 2066
2067static void dynamic_debug_remove(struct _ddebug *debug)
2068{
2069 if (debug)
2070 ddebug_remove_module(debug->modname);
2071}
2072
2065static void *module_alloc_update_bounds(unsigned long size) 2073static void *module_alloc_update_bounds(unsigned long size)
2066{ 2074{
2067 void *ret = module_alloc(size); 2075 void *ret = module_alloc(size);
@@ -2124,6 +2132,8 @@ static noinline struct module *load_module(void __user *umod,
2124 void *ptr = NULL; /* Stops spurious gcc warning */ 2132 void *ptr = NULL; /* Stops spurious gcc warning */
2125 unsigned long symoffs, stroffs, *strmap; 2133 unsigned long symoffs, stroffs, *strmap;
2126 void __percpu *percpu; 2134 void __percpu *percpu;
2135 struct _ddebug *debug = NULL;
2136 unsigned int num_debug = 0;
2127 2137
2128 mm_segment_t old_fs; 2138 mm_segment_t old_fs;
2129 2139
@@ -2476,15 +2486,9 @@ static noinline struct module *load_module(void __user *umod,
2476 kfree(strmap); 2486 kfree(strmap);
2477 strmap = NULL; 2487 strmap = NULL;
2478 2488
2479 if (!mod->taints) { 2489 if (!mod->taints)
2480 struct _ddebug *debug;
2481 unsigned int num_debug;
2482
2483 debug = section_objs(hdr, sechdrs, secstrings, "__verbose", 2490 debug = section_objs(hdr, sechdrs, secstrings, "__verbose",
2484 sizeof(*debug), &num_debug); 2491 sizeof(*debug), &num_debug);
2485 if (debug)
2486 dynamic_debug_setup(debug, num_debug);
2487 }
2488 2492
2489 err = module_finalize(hdr, sechdrs, mod); 2493 err = module_finalize(hdr, sechdrs, mod);
2490 if (err < 0) 2494 if (err < 0)
@@ -2526,10 +2530,13 @@ static noinline struct module *load_module(void __user *umod,
2526 goto unlock; 2530 goto unlock;
2527 } 2531 }
2528 2532
2533 if (debug)
2534 dynamic_debug_setup(debug, num_debug);
2535
2529 /* Find duplicate symbols */ 2536 /* Find duplicate symbols */
2530 err = verify_export_symbols(mod); 2537 err = verify_export_symbols(mod);
2531 if (err < 0) 2538 if (err < 0)
2532 goto unlock; 2539 goto ddebug;
2533 2540
2534 list_add_rcu(&mod->list, &modules); 2541 list_add_rcu(&mod->list, &modules);
2535 mutex_unlock(&module_mutex); 2542 mutex_unlock(&module_mutex);
@@ -2557,6 +2564,8 @@ static noinline struct module *load_module(void __user *umod,
2557 mutex_lock(&module_mutex); 2564 mutex_lock(&module_mutex);
2558 /* Unlink carefully: kallsyms could be walking list. */ 2565 /* Unlink carefully: kallsyms could be walking list. */
2559 list_del_rcu(&mod->list); 2566 list_del_rcu(&mod->list);
2567 ddebug:
2568 dynamic_debug_remove(debug);
2560 unlock: 2569 unlock:
2561 mutex_unlock(&module_mutex); 2570 mutex_unlock(&module_mutex);
2562 synchronize_sched(); 2571 synchronize_sched();