diff options
Diffstat (limited to 'fs')
-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 995986b8e36b..d925f55e4857 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -862,6 +862,7 @@ static int load_elf_binary(struct linux_binprm *bprm) | |||
862 | i < loc->elf_ex.e_phnum; i++, elf_ppnt++) { | 862 | i < loc->elf_ex.e_phnum; i++, elf_ppnt++) { |
863 | int elf_prot = 0, elf_flags; | 863 | int elf_prot = 0, elf_flags; |
864 | unsigned long k, vaddr; | 864 | unsigned long k, vaddr; |
865 | unsigned long total_size = 0; | ||
865 | 866 | ||
866 | if (elf_ppnt->p_type != PT_LOAD) | 867 | if (elf_ppnt->p_type != PT_LOAD) |
867 | continue; | 868 | continue; |
@@ -924,10 +925,16 @@ static int load_elf_binary(struct linux_binprm *bprm) | |||
924 | #else | 925 | #else |
925 | load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); | 926 | load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); |
926 | #endif | 927 | #endif |
928 | total_size = total_mapping_size(elf_phdata, | ||
929 | loc->elf_ex.e_phnum); | ||
930 | if (!total_size) { | ||
931 | error = -EINVAL; | ||
932 | goto out_free_dentry; | ||
933 | } | ||
927 | } | 934 | } |
928 | 935 | ||
929 | error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, | 936 | error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, |
930 | elf_prot, elf_flags, 0); | 937 | elf_prot, elf_flags, total_size); |
931 | if (BAD_ADDR(error)) { | 938 | if (BAD_ADDR(error)) { |
932 | retval = IS_ERR((void *)error) ? | 939 | retval = IS_ERR((void *)error) ? |
933 | PTR_ERR((void*)error) : -EINVAL; | 940 | PTR_ERR((void*)error) : -EINVAL; |