diff options
author | Kevin Hilman <khilman@linaro.org> | 2015-05-06 13:57:01 -0700 |
---|---|---|
committer | Kevin Hilman <khilman@linaro.org> | 2015-05-06 13:57:01 -0700 |
commit | 271de175c9af5be4ccc7a0e5701c76d3ccb92677 (patch) | |
tree | 08624b85629a42d9abca515389df397602154071 /fs/binfmt_elf.c | |
parent | 1dcd9896384ec3fe5c75829701d9babec7fe0d25 (diff) | |
parent | 99e64c4a808c55cb173b69dc21d28a4420eb22c5 (diff) |
Merge branch 'linux-3.14.y' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable into linux-linaro-lsk-v3.14
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r-- | fs/binfmt_elf.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index f4d7b2fc9ffb..78f46089a077 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -751,6 +751,7 @@ static int load_elf_binary(struct linux_binprm *bprm) i < loc->elf_ex.e_phnum; i++, elf_ppnt++) { int elf_prot = 0, elf_flags; unsigned long k, vaddr; + unsigned long total_size = 0; if (elf_ppnt->p_type != PT_LOAD) continue; @@ -815,10 +816,16 @@ static int load_elf_binary(struct linux_binprm *bprm) #else load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); #endif + total_size = total_mapping_size(elf_phdata, + loc->elf_ex.e_phnum); + if (!total_size) { + error = -EINVAL; + goto out_free_dentry; + } } error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, - elf_prot, elf_flags, 0); + elf_prot, elf_flags, total_size); if (BAD_ADDR(error)) { send_sig(SIGKILL, current, 0); retval = IS_ERR((void *)error) ? |