]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] small fix for not releasing the mmap semaphore in i386/arch_setup_additional_...
authorpageexec@freemail.hu <pageexec@freemail.hu>
Wed, 28 Jun 2006 18:44:16 +0000 (20:44 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 28 Jun 2006 19:05:50 +0000 (12:05 -0700)
the VDSO randomization code on i386 fails to release the mmap semaphore
if insert_vm_struct() fails.

[ Made the conditional unlikely. -- Linus ]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/sysenter.c

index c60419dee0180b7b19f94b2e40452c73ab54c493..713ba39d32c66db0e2ad4ca0580088ffccef785f 100644 (file)
@@ -148,8 +148,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
        vma->vm_mm = mm;
 
        ret = insert_vm_struct(mm, vma);
-       if (ret)
-               goto free_vma;
+       if (unlikely(ret)) {
+               kmem_cache_free(vm_area_cachep, vma);
+               goto up_fail;
+       }
 
        current->mm->context.vdso = (void *)addr;
        current_thread_info()->sysenter_return =
@@ -158,10 +160,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
 up_fail:
        up_write(&mm->mmap_sem);
        return ret;
-
-free_vma:
-       kmem_cache_free(vm_area_cachep, vma);
-       return ret;
 }
 
 const char *arch_vma_name(struct vm_area_struct *vma)