diff options
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -405,7 +405,7 @@ static void validate_mm_rb(struct rb_root *root, struct vm_area_struct *ignore) | |||
405 | } | 405 | } |
406 | } | 406 | } |
407 | 407 | ||
408 | void validate_mm(struct mm_struct *mm) | 408 | static 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 | */ |
2921 | int install_special_mapping(struct mm_struct *mm, | 2921 | struct 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 | ||
2953 | out: | 2953 | out: |
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 | |||
2958 | int 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 | ||
2958 | static DEFINE_MUTEX(mm_all_locks_mutex); | 2970 | static DEFINE_MUTEX(mm_all_locks_mutex); |