提交 e2b8b25a 编写于 作者: T Tetsuo Handa 提交者: James Morris

TOMOYO: Remove redundant tasklist_lock.

rcu_read_lock() is sufficient for calling find_task_by_pid_ns()/find_task_by_vpid().
Signed-off-by: NTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 e00fb3f7
...@@ -984,14 +984,12 @@ static bool tomoyo_select_domain(struct tomoyo_io_buffer *head, ...@@ -984,14 +984,12 @@ static bool tomoyo_select_domain(struct tomoyo_io_buffer *head,
(global_pid = true, sscanf(data, "global-pid=%u", &pid) == 1)) { (global_pid = true, sscanf(data, "global-pid=%u", &pid) == 1)) {
struct task_struct *p; struct task_struct *p;
rcu_read_lock(); rcu_read_lock();
read_lock(&tasklist_lock);
if (global_pid) if (global_pid)
p = find_task_by_pid_ns(pid, &init_pid_ns); p = find_task_by_pid_ns(pid, &init_pid_ns);
else else
p = find_task_by_vpid(pid); p = find_task_by_vpid(pid);
if (p) if (p)
domain = tomoyo_real_domain(p); domain = tomoyo_real_domain(p);
read_unlock(&tasklist_lock);
rcu_read_unlock(); rcu_read_unlock();
} else if (!strncmp(data, "domain=", 7)) { } else if (!strncmp(data, "domain=", 7)) {
if (tomoyo_domain_def(data + 7)) if (tomoyo_domain_def(data + 7))
...@@ -1664,14 +1662,12 @@ static void tomoyo_read_pid(struct tomoyo_io_buffer *head) ...@@ -1664,14 +1662,12 @@ static void tomoyo_read_pid(struct tomoyo_io_buffer *head)
global_pid = true; global_pid = true;
pid = (unsigned int) simple_strtoul(buf, NULL, 10); pid = (unsigned int) simple_strtoul(buf, NULL, 10);
rcu_read_lock(); rcu_read_lock();
read_lock(&tasklist_lock);
if (global_pid) if (global_pid)
p = find_task_by_pid_ns(pid, &init_pid_ns); p = find_task_by_pid_ns(pid, &init_pid_ns);
else else
p = find_task_by_vpid(pid); p = find_task_by_vpid(pid);
if (p) if (p)
domain = tomoyo_real_domain(p); domain = tomoyo_real_domain(p);
read_unlock(&tasklist_lock);
rcu_read_unlock(); rcu_read_unlock();
if (!domain) if (!domain)
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册