Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6
authorLinus Torvalds <torvalds@g5.osdl.org>
Sat, 16 Jul 2005 17:24:32 +0000 (10:24 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 16 Jul 2005 17:24:32 +0000 (10:24 -0700)
arch/x86_64/ia32/syscall32.c

index 01d8db1a1c09c7bff982a740bf5222735e996893..816a3b89f13d870865d0a85353ae7a58c7386b65 100644 (file)
@@ -57,6 +57,7 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
        int npages = (VSYSCALL32_END - VSYSCALL32_BASE) >> PAGE_SHIFT;
        struct vm_area_struct *vma;
        struct mm_struct *mm = current->mm;
+       int ret;
 
        vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
        if (!vma)
@@ -78,7 +79,11 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
        vma->vm_mm = mm;
 
        down_write(&mm->mmap_sem);
-       insert_vm_struct(mm, vma);
+       if ((ret = insert_vm_struct(mm, vma))) {
+               up_write(&mm->mmap_sem);
+               kmem_cache_free(vm_area_cachep, vma);
+               return ret;
+       }
        mm->total_vm += npages;
        up_write(&mm->mmap_sem);
        return 0;