diff options
| author | Dmitry Shmidt <dimitrysh@google.com> | 2016-09-26 10:37:43 -0700 |
|---|---|---|
| committer | Dmitry Shmidt <dimitrysh@google.com> | 2016-09-26 10:37:43 -0700 |
| commit | 734bcf32c23442e81891641ae05e08108a4010d5 (patch) | |
| tree | b41cc318506b0c38ddf404520ba67753f3ab5452 /kernel/fork.c | |
| parent | 551569f25ec07596e144ffbc7911dd631645e63b (diff) | |
| parent | 8d5e93bb8c9c48ee5948f6b1aff0e895381f09e6 (diff) | |
Merge tag 'v4.4.22' into android-4.4.y
This is the 4.4.22 stable release
Change-Id: Id49e3c87d2cacb2fa85d85a17226f718f4a5ac28
Diffstat (limited to 'kernel/fork.c')
| -rw-r--r-- | kernel/fork.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index d6a6da547e41..a1d163250909 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -764,6 +764,29 @@ struct file *get_mm_exe_file(struct mm_struct *mm) EXPORT_SYMBOL(get_mm_exe_file); /** + * get_task_exe_file - acquire a reference to the task's executable file + * + * Returns %NULL if task's mm (if any) has no associated executable file or + * this is a kernel thread with borrowed mm (see the comment above get_task_mm). + * User must release file via fput(). + */ +struct file *get_task_exe_file(struct task_struct *task) +{ + struct file *exe_file = NULL; + struct mm_struct *mm; + + task_lock(task); + mm = task->mm; + if (mm) { + if (!(task->flags & PF_KTHREAD)) + exe_file = get_mm_exe_file(mm); + } + task_unlock(task); + return exe_file; +} +EXPORT_SYMBOL(get_task_exe_file); + +/** * get_task_mm - acquire a reference to the task's mm * * Returns %NULL if the task has no mm. Checks PF_KTHREAD (meaning |
