aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/timer_stats.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@sw.ru>2007-05-08 03:28:43 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:08 -0400
commit9d65cb4a1718a072898c7a57a3bc61b2dc4bcd4d (patch)
tree9e3fd1c9e61e8ed16959d115a9a3f6f7eb0bbf21 /kernel/time/timer_stats.c
parentffb45122766db220d0bf3d01848d575fbbcb6430 (diff)
Fix race between cat /proc/*/wchan and rmmod et al
kallsyms_lookup() can go iterating over modules list unprotected which is OK for emergency situations (oops), but not OK for regular stuff like /proc/*/wchan. Introduce lookup_symbol_name()/lookup_module_symbol_name() which copy symbol name into caller-supplied buffer or return -ERANGE. All copying is done with module_mutex held, so... Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/time/timer_stats.c')
-rw-r--r--kernel/time/timer_stats.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/kernel/time/timer_stats.c b/kernel/time/timer_stats.c
index 946ed45f7d2f..868f1bceb07f 100644
--- a/kernel/time/timer_stats.c
+++ b/kernel/time/timer_stats.c
@@ -257,14 +257,12 @@ void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
257 257
258static void print_name_offset(struct seq_file *m, unsigned long addr) 258static void print_name_offset(struct seq_file *m, unsigned long addr)
259{ 259{
260 char namebuf[KSYM_NAME_LEN+1]; 260 char symname[KSYM_NAME_LEN+1];
261 const char *sym_name;
262 261
263 sym_name = kallsyms_lookup(addr, NULL, NULL, NULL, namebuf); 262 if (lookup_symbol_name(addr, symname) < 0)
264 if (sym_name)
265 seq_printf(m, "%s", sym_name);
266 else
267 seq_printf(m, "<%p>", (void *)addr); 263 seq_printf(m, "<%p>", (void *)addr);
264 else
265 seq_printf(m, "%s", symname);
268} 266}
269 267
270static int tstats_show(struct seq_file *m, void *v) 268static int tstats_show(struct seq_file *m, void *v)