Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

TOMOYO: Remove redundant tasklist_lock.

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>

authored by

Tetsuo Handa and committed by
James Morris
e2b8b25a e00fb3f7

-4
-4
security/tomoyo/common.c
··· 984 984 (global_pid = true, sscanf(data, "global-pid=%u", &pid) == 1)) { 985 985 struct task_struct *p; 986 986 rcu_read_lock(); 987 - read_lock(&tasklist_lock); 988 987 if (global_pid) 989 988 p = find_task_by_pid_ns(pid, &init_pid_ns); 990 989 else 991 990 p = find_task_by_vpid(pid); 992 991 if (p) 993 992 domain = tomoyo_real_domain(p); 994 - read_unlock(&tasklist_lock); 995 993 rcu_read_unlock(); 996 994 } else if (!strncmp(data, "domain=", 7)) { 997 995 if (tomoyo_domain_def(data + 7)) ··· 1662 1664 global_pid = true; 1663 1665 pid = (unsigned int) simple_strtoul(buf, NULL, 10); 1664 1666 rcu_read_lock(); 1665 - read_lock(&tasklist_lock); 1666 1667 if (global_pid) 1667 1668 p = find_task_by_pid_ns(pid, &init_pid_ns); 1668 1669 else 1669 1670 p = find_task_by_vpid(pid); 1670 1671 if (p) 1671 1672 domain = tomoyo_real_domain(p); 1672 - read_unlock(&tasklist_lock); 1673 1673 rcu_read_unlock(); 1674 1674 if (!domain) 1675 1675 return;