diff options
author | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-05-31 19:26:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 20:49:30 -0400 |
commit | af1be5a578a1ccc9961c55290f8c509a00a69036 (patch) | |
tree | f8659ba36228582a114c7809bdf580640eb626cf /arch | |
parent | 2214f707de257c35773d5cd68cec9e31b91e01ca (diff) |
blackfin: fix possible deadlock in decode_address()
Oleg Nesterov found an interesting deadlock possibility:
> sysrq_showregs_othercpus() does smp_call_function(showacpu)
> and showacpu() show_stack()->decode_address(). Now suppose that IPI
> interrupts the task holding read_lock(tasklist).
To fix this, blackfin should not grab the write_ variant of the
tasklist lock, read_ one is enough.
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/blackfin/kernel/trace.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/blackfin/kernel/trace.c b/arch/blackfin/kernel/trace.c index d08f0e3e2dcc..f7f7a18abca9 100644 --- a/arch/blackfin/kernel/trace.c +++ b/arch/blackfin/kernel/trace.c | |||
@@ -29,7 +29,7 @@ void decode_address(char *buf, unsigned long address) | |||
29 | { | 29 | { |
30 | struct task_struct *p; | 30 | struct task_struct *p; |
31 | struct mm_struct *mm; | 31 | struct mm_struct *mm; |
32 | unsigned long flags, offset; | 32 | unsigned long offset; |
33 | struct rb_node *n; | 33 | struct rb_node *n; |
34 | 34 | ||
35 | #ifdef CONFIG_KALLSYMS | 35 | #ifdef CONFIG_KALLSYMS |
@@ -113,7 +113,7 @@ void decode_address(char *buf, unsigned long address) | |||
113 | * mappings of all our processes and see if we can't be a whee | 113 | * mappings of all our processes and see if we can't be a whee |
114 | * bit more specific | 114 | * bit more specific |
115 | */ | 115 | */ |
116 | write_lock_irqsave(&tasklist_lock, flags); | 116 | read_lock(&tasklist_lock); |
117 | for_each_process(p) { | 117 | for_each_process(p) { |
118 | struct task_struct *t; | 118 | struct task_struct *t; |
119 | 119 | ||
@@ -186,7 +186,7 @@ __continue: | |||
186 | sprintf(buf, "/* kernel dynamic memory */"); | 186 | sprintf(buf, "/* kernel dynamic memory */"); |
187 | 187 | ||
188 | done: | 188 | done: |
189 | write_unlock_irqrestore(&tasklist_lock, flags); | 189 | read_unlock(&tasklist_lock); |
190 | } | 190 | } |
191 | 191 | ||
192 | #define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1) | 192 | #define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1) |