diff options
author | pageexec@freemail.hu <pageexec@freemail.hu> | 2006-06-28 14:44:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-28 15:05:50 -0400 |
commit | 79bc79b07c9c6f8ae9290704e9e503a9327fcbb2 (patch) | |
tree | 1e9b72b18d1605e8ea3fe72f9b992867a4697224 | |
parent | a39727f212426b9d5f9267b3318a2afaf9922d3b (diff) |
[PATCH] small fix for not releasing the mmap semaphore in i386/arch_setup_additional_pages
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>
-rw-r--r-- | arch/i386/kernel/sysenter.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/i386/kernel/sysenter.c b/arch/i386/kernel/sysenter.c index c60419dee018..713ba39d32c6 100644 --- a/arch/i386/kernel/sysenter.c +++ b/arch/i386/kernel/sysenter.c | |||
@@ -148,8 +148,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack) | |||
148 | vma->vm_mm = mm; | 148 | vma->vm_mm = mm; |
149 | 149 | ||
150 | ret = insert_vm_struct(mm, vma); | 150 | ret = insert_vm_struct(mm, vma); |
151 | if (ret) | 151 | if (unlikely(ret)) { |
152 | goto free_vma; | 152 | kmem_cache_free(vm_area_cachep, vma); |
153 | goto up_fail; | ||
154 | } | ||
153 | 155 | ||
154 | current->mm->context.vdso = (void *)addr; | 156 | current->mm->context.vdso = (void *)addr; |
155 | current_thread_info()->sysenter_return = | 157 | current_thread_info()->sysenter_return = |
@@ -158,10 +160,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack) | |||
158 | up_fail: | 160 | up_fail: |
159 | up_write(&mm->mmap_sem); | 161 | up_write(&mm->mmap_sem); |
160 | return ret; | 162 | return ret; |
161 | |||
162 | free_vma: | ||
163 | kmem_cache_free(vm_area_cachep, vma); | ||
164 | return ret; | ||
165 | } | 163 | } |
166 | 164 | ||
167 | const char *arch_vma_name(struct vm_area_struct *vma) | 165 | const char *arch_vma_name(struct vm_area_struct *vma) |