diff options
| author | Alex Shi <alex.shi@linaro.org> | 2016-10-05 13:21:50 +0200 |
|---|---|---|
| committer | Alex Shi <alex.shi@linaro.org> | 2016-10-05 13:21:50 +0200 |
| commit | 10fd238c91a8dd2fb9c9bce99eb4d357254fb3c6 (patch) | |
| tree | 7c24d0606e1183d104bd183ae5578a958e00fa34 /kernel/fork.c | |
| parent | e4f4f9e5b9ec7278b8384ea000c79325846a3872 (diff) | |
| parent | 8d5e93bb8c9c48ee5948f6b1aff0e895381f09e6 (diff) | |
Merge remote-tracking branch 'lts/linux-4.4.y' into linux-linaro-lsk-v4.4
Conflicts:
resovle the conflict on pax_copy for
arch/ia64/include/asm/uaccess.h
arch/powerpc/include/asm/uaccess.h
arch/sparc/include/asm/uaccess_32.h
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 c485cb156772..8860d1f50d24 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 |
