Commit ecc2bc8a authored by Michal Hocko's avatar Michal Hocko Committed by Linus Torvalds
Browse files

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: default avatarMichal Hocko <>
Acked-by: default avatarVlastimil Babka <>
Cc: Alexander Viro <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 864778b1
......@@ -1176,8 +1176,11 @@ static int load_elf_library(struct file *file)
len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr +
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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment