Commit 6175ecfe authored by Sripathi Kodi's avatar Sripathi Kodi Committed by Linus Torvalds

Use write_trylock_irqsave in ptrace_attach

This patch makes ptrace_attach use write_trylock_irqsave().

[akpm@linux-foundation.org: remove unneeded initialisation]
Signed-off-by: default avatarSripathi Kodi <sripathik@in.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e1f4a88c
...@@ -161,6 +161,7 @@ int ptrace_may_attach(struct task_struct *task) ...@@ -161,6 +161,7 @@ int ptrace_may_attach(struct task_struct *task)
int ptrace_attach(struct task_struct *task) int ptrace_attach(struct task_struct *task)
{ {
int retval; int retval;
unsigned long flags;
audit_ptrace(task); audit_ptrace(task);
...@@ -181,9 +182,7 @@ repeat: ...@@ -181,9 +182,7 @@ repeat:
* cpu's that may have task_lock). * cpu's that may have task_lock).
*/ */
task_lock(task); task_lock(task);
local_irq_disable(); if (!write_trylock_irqsave(&tasklist_lock, flags)) {
if (!write_trylock(&tasklist_lock)) {
local_irq_enable();
task_unlock(task); task_unlock(task);
do { do {
cpu_relax(); cpu_relax();
...@@ -211,7 +210,7 @@ repeat: ...@@ -211,7 +210,7 @@ repeat:
force_sig_specific(SIGSTOP, task); force_sig_specific(SIGSTOP, task);
bad: bad:
write_unlock_irq(&tasklist_lock); write_unlock_irqrestore(&tasklist_lock, flags);
task_unlock(task); task_unlock(task);
out: out:
return retval; return retval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment