From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Pavel Emelyanov <xemul@openvz.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] pids: sys_getpgid: use rcu_read_lock() instead of tasklist_lock
Date: Sun, 23 Mar 2008 20:51:37 +0300 [thread overview]
Message-ID: <20080323175137.GA3356@tv-sign.ru> (raw)
Convert sys_getpgid() to use rcu_read_lock() instead of tasklist_lock, make
sure we also check the result of task_pgrp_vnr().
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 25/kernel/sys.c~2_GETPGID 2008-03-23 19:25:36.000000000 +0300
+++ 25/kernel/sys.c 2008-03-23 20:39:03.000000000 +0300
@@ -988,19 +988,19 @@ asmlinkage long sys_getpgid(pid_t pid)
if (!pid)
return task_pgrp_vnr(current);
else {
- int retval;
+ int retval = 0;
struct task_struct *p;
- read_lock(&tasklist_lock);
+ rcu_read_lock();
p = find_task_by_vpid(pid);
- retval = -ESRCH;
if (p) {
retval = security_task_getpgid(p);
if (!retval)
retval = task_pgrp_vnr(p);
}
- read_unlock(&tasklist_lock);
- return retval;
+ rcu_read_unlock();
+
+ return retval ?: -ESRCH;
}
}
reply other threads:[~2008-03-23 17:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20080323175137.GA3356@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xemul@openvz.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
all inboxes | Powered by JetHome®