Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
  [PATCH] return to old errno choice in mkdir() et.al.
  [Patch] fs/binfmt_elf.c: fix wrong return values
  [PATCH] get rid of leak in compat_execve()
  [Patch] fs/binfmt_elf.c: fix a wrong free
  [PATCH] avoid multiplication overflows and signedness issues for max_fds
  [PATCH] dup_fd() part 4 - race fix
  [PATCH] dup_fd() - part 3
  [PATCH] dup_fd() part 2
  [PATCH] dup_fd() fixes, part 1
  [PATCH] take init_files to fs/file.c
  • Loading branch information
Linus Torvalds committed May 19, 2008
2 parents c9091f9 + e9baf6e commit e23a5f6
Show file tree
Hide file tree
Showing 33 changed files with 180 additions and 192 deletions.
1 change: 0 additions & 1 deletion arch/alpha/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/arm/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/avr32/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/blackfin/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <linux/fs.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);

Expand Down
1 change: 0 additions & 1 deletion arch/cris/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
*/

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/frv/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/h8300/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/m32r/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/m68k/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
* setup.
*/
static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/m68knommu/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/mips/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/mn10300/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/parisc/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <asm/pgalloc.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <asm/uaccess.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/s390/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/sh/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct pt_regs fake_swapper_regs;
Expand Down
1 change: 0 additions & 1 deletion arch/sparc/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <asm/uaccess.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/sparc64/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <asm/processor.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/um/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

static struct fs_struct init_fs = INIT_FS;
struct mm_struct init_mm = INIT_MM(init_mm);
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
EXPORT_SYMBOL(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/v850/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <asm/pgtable.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS (init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM (init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/x86/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <asm/desc.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
1 change: 0 additions & 1 deletion arch/xtensa/kernel/init_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <asm/uaccess.h>

static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
Expand Down
9 changes: 5 additions & 4 deletions fs/binfmt_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
return -EFAULT;
len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
if (!len || len > MAX_ARG_STRLEN)
return 0;
return -EINVAL;
p += len;
}
if (__put_user(0, argv))
Expand All @@ -268,7 +268,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
return -EFAULT;
len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
if (!len || len > MAX_ARG_STRLEN)
return 0;
return -EINVAL;
p += len;
}
if (__put_user(0, envp))
Expand Down Expand Up @@ -1900,7 +1900,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
/* alloc memory for large data structures: too large to be on stack */
elf = kmalloc(sizeof(*elf), GFP_KERNEL);
if (!elf)
goto cleanup;
goto out;

segs = current->mm->map_count;
#ifdef ELF_CORE_EXTRA_PHDRS
Expand Down Expand Up @@ -2034,8 +2034,9 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un
set_fs(fs);

cleanup:
kfree(elf);
free_note_info(&info);
kfree(elf);
out:
return has_dumped;
}

Expand Down
4 changes: 2 additions & 2 deletions fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ int compat_do_execve(char * filename,
/* execve success */
security_bprm_free(bprm);
acct_update_integrals(current);
kfree(bprm);
free_bprm(bprm);
return retval;
}

Expand All @@ -1424,7 +1424,7 @@ int compat_do_execve(char * filename,
}

out_kfree:
kfree(bprm);
free_bprm(bprm);

out_ret:
return retval;
Expand Down
12 changes: 8 additions & 4 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,12 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)

EXPORT_SYMBOL(search_binary_handler);

void free_bprm(struct linux_binprm *bprm)
{
free_arg_pages(bprm);
kfree(bprm);
}

/*
* sys_execve() executes a new program.
*/
Expand Down Expand Up @@ -1320,17 +1326,15 @@ int do_execve(char * filename,
retval = search_binary_handler(bprm,regs);
if (retval >= 0) {
/* execve success */
free_arg_pages(bprm);
security_bprm_free(bprm);
acct_update_integrals(current);
kfree(bprm);
free_bprm(bprm);
if (displaced)
put_files_struct(displaced);
return retval;
}

out:
free_arg_pages(bprm);
if (bprm->security)
security_bprm_free(bprm);

Expand All @@ -1344,7 +1348,7 @@ int do_execve(char * filename,
fput(bprm->file);
}
out_kfree:
kfree(bprm);
free_bprm(bprm);

out_files:
if (displaced)
Expand Down
Loading

0 comments on commit e23a5f6

Please sign in to comment.