Skip to content

Commit

Permalink
binfmt_elf: switch elf_map() to vm_mmap/vm_munmap
Browse files Browse the repository at this point in the history
No reason to hold ->mmap_sem over the sequence

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed May 31, 2012
1 parent 63d37a8 commit 5a5e4c2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fs/binfmt_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ static unsigned long elf_map(struct file *filep, unsigned long addr,
if (!size)
return addr;

down_write(&current->mm->mmap_sem);
/*
* total_size is the size of the ELF (interpreter) image.
* The _first_ mmap needs to know the full size, otherwise
Expand All @@ -340,13 +339,12 @@ static unsigned long elf_map(struct file *filep, unsigned long addr,
*/
if (total_size) {
total_size = ELF_PAGEALIGN(total_size);
map_addr = do_mmap(filep, addr, total_size, prot, type, off);
map_addr = vm_mmap(filep, addr, total_size, prot, type, off);
if (!BAD_ADDR(map_addr))
do_munmap(current->mm, map_addr+size, total_size-size);
vm_munmap(map_addr+size, total_size-size);
} else
map_addr = do_mmap(filep, addr, size, prot, type, off);
map_addr = vm_mmap(filep, addr, size, prot, type, off);

up_write(&current->mm->mmap_sem);
return(map_addr);
}

Expand Down

0 comments on commit 5a5e4c2

Please sign in to comment.