summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSripathi Kodi <sripathik@in.ibm.com>2007-07-15 23:39:26 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 09:05:40 -0700
commit6175ecfed3c81d388735c75f7a0ad08dc4de02d3 (patch)
tree83ac354507db40109bd114c233de2e7c36c92231 /kernel
parente1f4a88c5a15a86124a95ea712213bb7dab2ad99 (diff)
downloadlinux-6175ecfed3c81d388735c75f7a0ad08dc4de02d3.tar.gz
linux-6175ecfed3c81d388735c75f7a0ad08dc4de02d3.tar.bz2
linux-6175ecfed3c81d388735c75f7a0ad08dc4de02d3.zip
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: Sripathi Kodi <sripathik@in.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/ptrace.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index ad7949a589dd..b1d11f1c7cf7 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -161,6 +161,7 @@ int ptrace_may_attach(struct task_struct *task)
int ptrace_attach(struct task_struct *task)
{
int retval;
+ unsigned long flags;
audit_ptrace(task);
@@ -181,9 +182,7 @@ repeat:
* cpu's that may have task_lock).
*/
task_lock(task);
- local_irq_disable();
- if (!write_trylock(&tasklist_lock)) {
- local_irq_enable();
+ if (!write_trylock_irqsave(&tasklist_lock, flags)) {
task_unlock(task);
do {
cpu_relax();
@@ -211,7 +210,7 @@ repeat:
force_sig_specific(SIGSTOP, task);
bad:
- write_unlock_irq(&tasklist_lock);
+ write_unlock_irqrestore(&tasklist_lock, flags);
task_unlock(task);
out:
return retval;