Remove classmate debug patch
[lcapit-linux-patches.git] / simplify__bprm_mm_init-error-handling.patch
blob44a144195f14eb23866948fc02e6a11b470ff14d
1 ---
2 fs/exec.c | 16 +++++-----------
3 1 file changed, 5 insertions(+), 11 deletions(-)
5 --- linux-2.6-lcpt.orig/fs/exec.c
6 +++ linux-2.6-lcpt/fs/exec.c
7 @@ -240,13 +240,13 @@ static void flush_arg_page(struct linux_
9 static int __bprm_mm_init(struct linux_binprm *bprm)
11 - int err = -ENOMEM;
12 + int err;
13 struct vm_area_struct *vma = NULL;
14 struct mm_struct *mm = bprm->mm;
16 bprm->vma = vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
17 if (!vma)
18 - goto err;
19 + return -ENOMEM;
21 down_write(&mm->mmap_sem);
22 vma->vm_mm = mm;
23 @@ -265,7 +265,9 @@ static int __bprm_mm_init(struct linux_b
24 err = insert_vm_struct(mm, vma);
25 if (err) {
26 up_write(&mm->mmap_sem);
27 - goto err;
28 + kmem_cache_free(vm_area_cachep, vma);
29 + bprm->vma = NULL;
30 + return err;
33 mm->stack_vm = mm->total_vm = 1;
34 @@ -274,14 +276,6 @@ static int __bprm_mm_init(struct linux_b
35 bprm->p = vma->vm_end - sizeof(void *);
37 return 0;
39 -err:
40 - if (vma) {
41 - bprm->vma = NULL;
42 - kmem_cache_free(vm_area_cachep, vma);
43 - }
45 - return err;
48 static bool valid_arg_len(struct linux_binprm *bprm, long len)