Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223307
b: refs/heads/master
c: 462e635
h: refs/heads/master
i:
  223305: 7e9d554
  223303: 4a0b70e
v: v3
  • Loading branch information
Tavis Ormandy authored and Linus Torvalds committed Dec 15, 2010
1 parent 9995036 commit a59b4c9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0fcdcfbbc98f70f559e4b36773a69972489a6d8f
refs/heads/master: 462e635e5b73ba9a4c03913b77138cd57ce4b050
5 changes: 5 additions & 0 deletions trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ static int __bprm_mm_init(struct linux_binprm *bprm)
vma->vm_flags = VM_STACK_FLAGS | VM_STACK_INCOMPLETE_SETUP;
vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
INIT_LIST_HEAD(&vma->anon_vma_chain);

err = security_file_mmap(NULL, 0, 0, 0, vma->vm_start, 1);
if (err)
goto err;

err = insert_vm_struct(mm, vma);
if (err)
goto err;
Expand Down
16 changes: 12 additions & 4 deletions trunk/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2462,6 +2462,7 @@ int install_special_mapping(struct mm_struct *mm,
unsigned long addr, unsigned long len,
unsigned long vm_flags, struct page **pages)
{
int ret;
struct vm_area_struct *vma;

vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
Expand All @@ -2479,16 +2480,23 @@ int install_special_mapping(struct mm_struct *mm,
vma->vm_ops = &special_mapping_vmops;
vma->vm_private_data = pages;

if (unlikely(insert_vm_struct(mm, vma))) {
kmem_cache_free(vm_area_cachep, vma);
return -ENOMEM;
}
ret = security_file_mmap(NULL, 0, 0, 0, vma->vm_start, 1);
if (ret)
goto out;

ret = insert_vm_struct(mm, vma);
if (ret)
goto out;

mm->total_vm += len >> PAGE_SHIFT;

perf_event_mmap(vma);

return 0;

out:
kmem_cache_free(vm_area_cachep, vma);
return ret;
}

static DEFINE_MUTEX(mm_all_locks_mutex);
Expand Down

0 comments on commit a59b4c9

Please sign in to comment.