From: Sripathi Kodi Date: Mon, 16 Jul 2007 06:39:26 +0000 (-0700) Subject: Use write_trylock_irqsave in ptrace_attach X-Git-Tag: v2.6.23-rc1~972 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=6175ecfed3c81d388735c75f7a0ad08dc4de02d3;p=linux-2.6-omap-h63xx.git 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 Cc: Ingo Molnar Cc: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/ptrace.c b/kernel/ptrace.c index ad7949a589d..b1d11f1c7cf 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;