summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorMike Rapoport <rppt@linux.vnet.ibm.com>2018-02-07 00:40:17 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-07 03:32:46 +0100
commit2ee0826085d1c0281cb60c1f4bc3e0c27efeedc3 (patch)
treebb2dc8915be7e4f0fea7438edf380d84b896f80a /security
parentdrivers/rapidio/devices/tsi721_dma.c: adjust six checks for null pointers (diff)
downloadlinux-2ee0826085d1c0281cb60c1f4bc3e0c27efeedc3.tar.xz
linux-2ee0826085d1c0281cb60c1f4bc3e0c27efeedc3.zip
pids: introduce find_get_task_by_vpid() helper
There are several functions that do find_task_by_vpid() followed by get_task_struct(). We can use a helper function instead. Link: http://lkml.kernel.org/r/1509602027-11337-1-git-send-email-rppt@linux.vnet.ibm.com Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Acked-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security')
-rw-r--r--security/yama/yama_lsm.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c
index 8298e094f4f7..ffda91a4a1aa 100644
--- a/security/yama/yama_lsm.c
+++ b/security/yama/yama_lsm.c
@@ -250,15 +250,10 @@ int yama_task_prctl(int option, unsigned long arg2, unsigned long arg3,
} else {
struct task_struct *tracer;
- rcu_read_lock();
- tracer = find_task_by_vpid(arg2);
- if (tracer)
- get_task_struct(tracer);
- else
+ tracer = find_get_task_by_vpid(arg2);
+ if (!tracer) {
rc = -EINVAL;
- rcu_read_unlock();
-
- if (tracer) {
+ } else {
rc = yama_ptracer_add(tracer, myself);
put_task_struct(tracer);
}