summaryrefslogtreecommitdiff
path: root/fs/proc
diff options
context:
space:
mode:
authorMateusz Guzik <mguzik@redhat.com>2016-08-23 16:20:38 +0200
committerPaul Moore <paul@paul-moore.com>2016-08-31 16:11:20 -0400
commitcd81a9170e69e018bbaba547c1fd85a585f5697a (patch)
treeb0c11dc4cc55aba04e21f8c7352b8c516124cbdb /fs/proc
parent43761473c254b45883a64441dd0bc85a42f3645c (diff)
mm: introduce get_task_exe_file
For more convenient access if one has a pointer to the task. As a minor nit take advantage of the fact that only task lock + rcu are needed to safely grab ->exe_file. This saves mm refcount dance. Use the helper in proc_exe_link. Signed-off-by: Mateusz Guzik <mguzik@redhat.com> Acked-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Acked-by: Richard Guy Briggs <rgb@redhat.com> Cc: <stable@vger.kernel.org> # 4.3.x Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/base.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 0d163a84082d..da8b1943ba04 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1552,18 +1552,13 @@ static const struct file_operations proc_pid_set_comm_operations = {
static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
{
struct task_struct *task;
- struct mm_struct *mm;
struct file *exe_file;
task = get_proc_task(d_inode(dentry));
if (!task)
return -ENOENT;
- mm = get_task_mm(task);
+ exe_file = get_task_exe_file(task);
put_task_struct(task);
- if (!mm)
- return -ENOENT;
- exe_file = get_mm_exe_file(mm);
- mmput(mm);
if (exe_file) {
*exe_path = exe_file->f_path;
path_get(&exe_file->f_path);