diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2020-11-21 00:14:19 +0100 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2020-12-10 19:39:32 +0100 |
commit | 1f702603e7125a390b5cdf5ce00539781cfcc86a (patch) | |
tree | ed62c7824115f6c452bf18f24b2f401b6206e020 /fs/exec.c | |
parent | exec: Move unshare_files to fix posix file locking during exec (diff) | |
download | linux-1f702603e7125a390b5cdf5ce00539781cfcc86a.tar.xz linux-1f702603e7125a390b5cdf5ce00539781cfcc86a.zip |
exec: Simplify unshare_files
Now that exec no longer needs to return the unshared files to their
previous value there is no reason to return displaced.
Instead when unshare_fd creates a copy of the file table, call
put_files_struct before returning from unshare_files.
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-2-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-2-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/exec.c b/fs/exec.c index 0d6533ab1c97..48fa4fc1b116 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1238,7 +1238,6 @@ void __set_task_comm(struct task_struct *tsk, const char *buf, bool exec) int begin_new_exec(struct linux_binprm * bprm) { struct task_struct *me = current; - struct files_struct *displaced; int retval; /* Once we are committed compute the creds */ @@ -1259,11 +1258,9 @@ int begin_new_exec(struct linux_binprm * bprm) goto out; /* Ensure the files table is not shared. */ - retval = unshare_files(&displaced); + retval = unshare_files(); if (retval) goto out; - if (displaced) - put_files_struct(displaced); /* * Must be called _before_ exec_mmap() as bprm->mm is |