aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 5932ce961218..46433e137abc 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -405,7 +405,7 @@ static void validate_mm_rb(struct rb_root *root, struct vm_area_struct *ignore)
405 } 405 }
406} 406}
407 407
408void validate_mm(struct mm_struct *mm) 408static void validate_mm(struct mm_struct *mm)
409{ 409{
410 int bug = 0; 410 int bug = 0;
411 int i = 0; 411 int i = 0;
@@ -2918,7 +2918,7 @@ static const struct vm_operations_struct special_mapping_vmops = {
2918 * The array pointer and the pages it points to are assumed to stay alive 2918 * The array pointer and the pages it points to are assumed to stay alive
2919 * for as long as this mapping might exist. 2919 * for as long as this mapping might exist.
2920 */ 2920 */
2921int install_special_mapping(struct mm_struct *mm, 2921struct vm_area_struct *_install_special_mapping(struct mm_struct *mm,
2922 unsigned long addr, unsigned long len, 2922 unsigned long addr, unsigned long len,
2923 unsigned long vm_flags, struct page **pages) 2923 unsigned long vm_flags, struct page **pages)
2924{ 2924{
@@ -2927,7 +2927,7 @@ int install_special_mapping(struct mm_struct *mm,
2927 2927
2928 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); 2928 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
2929 if (unlikely(vma == NULL)) 2929 if (unlikely(vma == NULL))
2930 return -ENOMEM; 2930 return ERR_PTR(-ENOMEM);
2931 2931
2932 INIT_LIST_HEAD(&vma->anon_vma_chain); 2932 INIT_LIST_HEAD(&vma->anon_vma_chain);
2933 vma->vm_mm = mm; 2933 vma->vm_mm = mm;
@@ -2948,11 +2948,23 @@ int install_special_mapping(struct mm_struct *mm,
2948 2948
2949 perf_event_mmap(vma); 2949 perf_event_mmap(vma);
2950 2950
2951 return 0; 2951 return vma;
2952 2952
2953out: 2953out:
2954 kmem_cache_free(vm_area_cachep, vma); 2954 kmem_cache_free(vm_area_cachep, vma);
2955 return ret; 2955 return ERR_PTR(ret);
2956}
2957
2958int install_special_mapping(struct mm_struct *mm,
2959 unsigned long addr, unsigned long len,
2960 unsigned long vm_flags, struct page **pages)
2961{
2962 struct vm_area_struct *vma = _install_special_mapping(mm,
2963 addr, len, vm_flags, pages);
2964
2965 if (IS_ERR(vma))
2966 return PTR_ERR(vma);
2967 return 0;
2956} 2968}
2957 2969
2958static DEFINE_MUTEX(mm_all_locks_mutex); 2970static DEFINE_MUTEX(mm_all_locks_mutex);