lkml.org 
[lkml]   [2007]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] Use write_trylock_irqsave in ptrace_attach
Date
Hi,

This patch makes ptrace_attach use write_trylock_irqsave.

Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>

---
kernel/ptrace.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
Index: linux-2.6.21/kernel/ptrace.c
===================================================================
--- linux-2.6.21.orig/kernel/ptrace.c
+++ linux-2.6.21/kernel/ptrace.c
@@ -160,6 +160,7 @@ int ptrace_may_attach(struct task_struct
int ptrace_attach(struct task_struct *task)
{
int retval;
+ unsigned long flags = 0;

retval = -EPERM;
if (task->pid <= 1)
@@ -178,9 +179,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();
@@ -208,7 +207,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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-05-09 10:47    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site