Skip to content

Commit af1be5a

Browse files
Anton Vorontsovtorvalds
authored andcommitted
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>
1 parent 2214f70 commit af1be5a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎arch/blackfin/kernel/trace.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void decode_address(char *buf, unsigned long address)
2929
{
3030
struct task_struct *p;
3131
struct mm_struct *mm;
32-
unsigned long flags, offset;
32+
unsigned long offset;
3333
struct rb_node *n;
3434

3535
#ifdef CONFIG_KALLSYMS
@@ -113,7 +113,7 @@ void decode_address(char *buf, unsigned long address)
113113
* mappings of all our processes and see if we can't be a whee
114114
* bit more specific
115115
*/
116-
write_lock_irqsave(&tasklist_lock, flags);
116+
read_lock(&tasklist_lock);
117117
for_each_process(p) {
118118
struct task_struct *t;
119119

@@ -186,7 +186,7 @@ void decode_address(char *buf, unsigned long address)
186186
sprintf(buf, "/* kernel dynamic memory */");
187187

188188
done:
189-
write_unlock_irqrestore(&tasklist_lock, flags);
189+
read_unlock(&tasklist_lock);
190190
}
191191

192192
#define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1)

0 commit comments

Comments
 (0)