You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[PATCH] sanitize handling of shared descriptor tables in failing execve()
* unshare_files() can fail; doing it after irreversible actions is wrong and de_thread() is certainly irreversible. * since we do it unconditionally anyway, we might as well do it in do_execve() and save ourselves the PITA in binfmt handlers, etc. * while we are at it, binfmt_som actually leaked files_struct on failure. As a side benefit, unshare_files(), put_files_struct() and reset_files_struct() become unexported. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -194,7 +194,6 @@ load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs)
|
||||
unsigned long som_entry;
|
||||
struct som_hdr *som_ex;
|
||||
struct som_exec_auxhdr *hpuxhdr;
|
||||
struct files_struct *files;
|
||||
|
||||
/* Get the exec-header */
|
||||
som_ex = (struct som_hdr *) bprm->buf;
|
||||
@@ -221,15 +220,6 @@ load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs)
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
files = current->files; /* Refcounted so ok */
|
||||
retval = unshare_files();
|
||||
if (retval < 0)
|
||||
goto out_free;
|
||||
if (files == current->files) {
|
||||
put_files_struct(files);
|
||||
files = NULL;
|
||||
}
|
||||
|
||||
retval = get_unused_fd();
|
||||
if (retval < 0)
|
||||
goto out_free;
|
||||
|
||||
Reference in New Issue
Block a user