[PATCH] audit: Protect find_task_by_vpid() with RCU.

From: Tetsuo Handa
Date: Thu Feb 25 2010 - 22:47:43 EST


[PATCH] audit: Protect find_task_by_vpid() with RCU.

Holding tasklist_lock is no longer sufficient for find_task_by_vpid().
Explicit rcu_read_lock() is required.

Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
---
kernel/audit.c | 6 ++++++
1 file changed, 6 insertions(+)

--- linux-2.6.33.orig/kernel/audit.c
+++ linux-2.6.33/kernel/audit.c
@@ -468,7 +468,9 @@ static int audit_prepare_user_tty(pid_t
int err;

read_lock(&tasklist_lock);
+ rcu_read_lock();
tsk = find_task_by_vpid(pid);
+ rcu_read_unlock();
err = -ESRCH;
if (!tsk)
goto out;
@@ -882,7 +884,9 @@ static int audit_receive_msg(struct sk_b
struct task_struct *tsk;

read_lock(&tasklist_lock);
+ rcu_read_lock();
tsk = find_task_by_vpid(pid);
+ rcu_read_unlock();
if (!tsk)
err = -ESRCH;
else {
@@ -905,7 +909,9 @@ static int audit_receive_msg(struct sk_b
if (s->enabled != 0 && s->enabled != 1)
return -EINVAL;
read_lock(&tasklist_lock);
+ rcu_read_lock();
tsk = find_task_by_vpid(pid);
+ rcu_read_unlock();
if (!tsk)
err = -ESRCH;
else {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/