diff options
author | Michal Hocko <[email protected]> | 2016-05-23 16:25:39 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2016-05-23 17:04:14 -0700 |
commit | ecc2bc8ac03884266cf73f8a2a42b911465b2fbc (patch) | |
tree | 9a9edd23784c51e8863c0259900a62bce07ad765 | |
parent | 864778b154233d3a673c520aa9606777589ecee7 (diff) |
mm, elf: handle vm_brk error
load_elf_library doesn't handle vm_brk failure although nothing really
indicates it cannot do that because the function is allowed to fail due
to vm_mmap failures already. This might be not a problem now but later
patch will make vm_brk killable (resp. mmap_sem for write waiting will
become killable) and so the failure will be more probable.
Signed-off-by: Michal Hocko <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Alexander Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | fs/binfmt_elf.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 56224ffa94d2..938fc4ede764 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1176,8 +1176,11 @@ static int load_elf_library(struct file *file) len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + ELF_MIN_ALIGN - 1); bss = eppnt->p_memsz + eppnt->p_vaddr; - if (bss > len) - vm_brk(len, bss - len); + if (bss > len) { + error = vm_brk(len, bss - len); + if (BAD_ADDR(error)) + goto out_free_ph; + } error = 0; out_free_ph: |