OSDN Git Service

TOMOYO: Remove redundant tasklist_lock.
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Tue, 11 Oct 2011 05:05:08 +0000 (14:05 +0900)
committerJames Morris <jmorris@namei.org>
Wed, 12 Oct 2011 01:15:18 +0000 (12:15 +1100)
rcu_read_lock() is sufficient for calling find_task_by_pid_ns()/find_task_by_vpid().

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
security/tomoyo/common.c

index 2e28020..365f3bd 100644 (file)
@@ -984,14 +984,12 @@ static bool tomoyo_select_domain(struct tomoyo_io_buffer *head,
            (global_pid = true, sscanf(data, "global-pid=%u", &pid) == 1)) {
                struct task_struct *p;
                rcu_read_lock();
-               read_lock(&tasklist_lock);
                if (global_pid)
                        p = find_task_by_pid_ns(pid, &init_pid_ns);
                else
                        p = find_task_by_vpid(pid);
                if (p)
                        domain = tomoyo_real_domain(p);
-               read_unlock(&tasklist_lock);
                rcu_read_unlock();
        } else if (!strncmp(data, "domain=", 7)) {
                if (tomoyo_domain_def(data + 7))
@@ -1664,14 +1662,12 @@ static void tomoyo_read_pid(struct tomoyo_io_buffer *head)
                global_pid = true;
        pid = (unsigned int) simple_strtoul(buf, NULL, 10);
        rcu_read_lock();
-       read_lock(&tasklist_lock);
        if (global_pid)
                p = find_task_by_pid_ns(pid, &init_pid_ns);
        else
                p = find_task_by_vpid(pid);
        if (p)
                domain = tomoyo_real_domain(p);
-       read_unlock(&tasklist_lock);
        rcu_read_unlock();
        if (!domain)
                return;