diff options
author | Török Edwin <edwintorok@gmail.com> | 2008-11-23 06:08:10 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-23 06:20:26 -0500 |
commit | e38da59269be8c0196d16dff1be5bb26076afc6a (patch) | |
tree | b43829f918725af5a2875f0244db62c4cc701c27 | |
parent | 8d26487fd4ddda7a0237da418fb8669fb06ae557 (diff) |
tracing/stack-tracer: avoid races accessing file
Impact: fix race
vma->vm_file reference is only stable while holding the mmap_sem,
so move usage of it to within the critical section.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/trace/trace.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 4c3bd82cec49..48d1536f1ca4 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1470,13 +1470,13 @@ static inline int seq_print_user_ip(struct trace_seq *s, struct mm_struct *mm, | |||
1470 | file = vma->vm_file; | 1470 | file = vma->vm_file; |
1471 | vmstart = vma->vm_start; | 1471 | vmstart = vma->vm_start; |
1472 | } | 1472 | } |
1473 | if (file) { | ||
1474 | ret = trace_seq_path(s, &file->f_path); | ||
1475 | if (ret) | ||
1476 | ret = trace_seq_printf(s, "[+0x%lx]", ip - vmstart); | ||
1477 | } | ||
1473 | up_read(&mm->mmap_sem); | 1478 | up_read(&mm->mmap_sem); |
1474 | } | 1479 | } |
1475 | if (file) { | ||
1476 | ret = trace_seq_path(s, &file->f_path); | ||
1477 | if (ret) | ||
1478 | ret = trace_seq_printf(s, "[+0x%lx]", ip - vmstart); | ||
1479 | } | ||
1480 | if (ret && ((sym_flags & TRACE_ITER_SYM_ADDR) || !file)) | 1480 | if (ret && ((sym_flags & TRACE_ITER_SYM_ADDR) || !file)) |
1481 | ret = trace_seq_printf(s, " <" IP_FMT ">", ip); | 1481 | ret = trace_seq_printf(s, " <" IP_FMT ">", ip); |
1482 | return ret; | 1482 | return ret; |