aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc64')
-rw-r--r--arch/ppc64/kernel/vdso.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/ppc64/kernel/vdso.c b/arch/ppc64/kernel/vdso.c
index 4777676365fe..efa985f05aca 100644
--- a/arch/ppc64/kernel/vdso.c
+++ b/arch/ppc64/kernel/vdso.c
@@ -224,10 +224,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack)
224 vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); 224 vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
225 if (vma == NULL) 225 if (vma == NULL)
226 return -ENOMEM; 226 return -ENOMEM;
227 if (security_vm_enough_memory(vdso_pages)) { 227
228 kmem_cache_free(vm_area_cachep, vma);
229 return -ENOMEM;
230 }
231 memset(vma, 0, sizeof(*vma)); 228 memset(vma, 0, sizeof(*vma));
232 229
233 /* 230 /*
@@ -237,8 +234,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack)
237 */ 234 */
238 vdso_base = get_unmapped_area(NULL, vdso_base, 235 vdso_base = get_unmapped_area(NULL, vdso_base,
239 vdso_pages << PAGE_SHIFT, 0, 0); 236 vdso_pages << PAGE_SHIFT, 0, 0);
240 if (vdso_base & ~PAGE_MASK) 237 if (vdso_base & ~PAGE_MASK) {
238 kmem_cache_free(vm_area_cachep, vma);
241 return (int)vdso_base; 239 return (int)vdso_base;
240 }
242 241
243 current->thread.vdso_base = vdso_base; 242 current->thread.vdso_base = vdso_base;
244 243
@@ -266,7 +265,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack)
266 vma->vm_ops = &vdso_vmops; 265 vma->vm_ops = &vdso_vmops;
267 266
268 down_write(&mm->mmap_sem); 267 down_write(&mm->mmap_sem);
269 insert_vm_struct(mm, vma); 268 if (insert_vm_struct(mm, vma)) {
269 up_write(&mm->mmap_sem);
270 kmem_cache_free(vm_area_cachep, vma);
271 return -ENOMEM;
272 }
270 mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 273 mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
271 up_write(&mm->mmap_sem); 274 up_write(&mm->mmap_sem);
272 275