Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200785
b: refs/heads/master
c: ff49d74
h: refs/heads/master
i:
  200783: 41dbc1c
v: v3
  • Loading branch information
Yehuda Sadeh authored and Linus Torvalds committed Jul 5, 2010
1 parent 9dc5986 commit 2d6ab33
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e3668dd83ba5958429984286efbc3055be5344c4
refs/heads/master: ff49d74ad383f54041378144ca1a229ee9aeaa59
4 changes: 2 additions & 2 deletions trunk/include/linux/dynamic_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
const char *modname);

#if defined(CONFIG_DYNAMIC_DEBUG)
extern int ddebug_remove_module(char *mod_name);
extern int ddebug_remove_module(const char *mod_name);

#define __dynamic_dbg_enabled(dd) ({ \
int __ret = 0; \
Expand Down Expand Up @@ -73,7 +73,7 @@ extern int ddebug_remove_module(char *mod_name);

#else

static inline int ddebug_remove_module(char *mod)
static inline int ddebug_remove_module(const char *mod)
{
return 0;
}
Expand Down
23 changes: 15 additions & 8 deletions trunk/kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,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);
Expand Down Expand Up @@ -2124,6 +2130,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;

Expand Down Expand Up @@ -2476,15 +2484,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)
Expand Down Expand Up @@ -2526,10 +2528,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);
Expand Down Expand Up @@ -2557,6 +2562,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();
Expand Down
2 changes: 1 addition & 1 deletion trunk/lib/dynamic_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ static void ddebug_table_free(struct ddebug_table *dt)
* Called in response to a module being unloaded. Removes
* any ddebug_table's which point at the module.
*/
int ddebug_remove_module(char *mod_name)
int ddebug_remove_module(const char *mod_name)
{
struct ddebug_table *dt, *nextdt;
int ret = -ENOENT;
Expand Down

0 comments on commit 2d6ab33

Please sign in to comment.