aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorJeremy Erickson <jerickso@cs.unc.edu>2014-04-18 17:06:00 -0400
committerJeremy Erickson <jerickso@cs.unc.edu>2014-04-18 17:06:00 -0400
commita215aa7b9ab3759c047201199fba64d3042d7f13 (patch)
treebca37493d9b2233450e6d3ffced1261d0e4f71fe /mm/mmap.c
parentd31199a77ef606f1d06894385f1852181ba6136b (diff)
Update 2.6.36 to 2.6.36.4wip-dissipation2-jerickso
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 00161a48a451..283a0a84ea2c 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2460,6 +2460,7 @@ int install_special_mapping(struct mm_struct *mm,
2460 unsigned long addr, unsigned long len, 2460 unsigned long addr, unsigned long len,
2461 unsigned long vm_flags, struct page **pages) 2461 unsigned long vm_flags, struct page **pages)
2462{ 2462{
2463 int ret;
2463 struct vm_area_struct *vma; 2464 struct vm_area_struct *vma;
2464 2465
2465 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); 2466 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
@@ -2477,16 +2478,23 @@ int install_special_mapping(struct mm_struct *mm,
2477 vma->vm_ops = &special_mapping_vmops; 2478 vma->vm_ops = &special_mapping_vmops;
2478 vma->vm_private_data = pages; 2479 vma->vm_private_data = pages;
2479 2480
2480 if (unlikely(insert_vm_struct(mm, vma))) { 2481 ret = security_file_mmap(NULL, 0, 0, 0, vma->vm_start, 1);
2481 kmem_cache_free(vm_area_cachep, vma); 2482 if (ret)
2482 return -ENOMEM; 2483 goto out;
2483 } 2484
2485 ret = insert_vm_struct(mm, vma);
2486 if (ret)
2487 goto out;
2484 2488
2485 mm->total_vm += len >> PAGE_SHIFT; 2489 mm->total_vm += len >> PAGE_SHIFT;
2486 2490
2487 perf_event_mmap(vma); 2491 perf_event_mmap(vma);
2488 2492
2489 return 0; 2493 return 0;
2494
2495out:
2496 kmem_cache_free(vm_area_cachep, vma);
2497 return ret;
2490} 2498}
2491 2499
2492static DEFINE_MUTEX(mm_all_locks_mutex); 2500static DEFINE_MUTEX(mm_all_locks_mutex);