From: Sripathi Kodi <sripathik@in.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org
Subject: [PATCH 2/2] Use write_trylock_irqsave in ptrace_attach
Date: Wed, 9 May 2007 14:13:27 +0530 [thread overview]
Message-ID: <200705091413.27344.sripathik@in.ibm.com> (raw)
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;
next reply other threads:[~2007-05-09 8:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-09 8:43 Sripathi Kodi [this message]
2007-05-10 1:50 ` [PATCH 2/2] Use write_trylock_irqsave in ptrace_attach Andrew Morton
2007-05-10 5:01 ` Sripathi Kodi
2007-05-10 12:21 ` Sripathi Kodi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200705091413.27344.sripathik@in.ibm.com \
--to=sripathik@in.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox