x86: Set context.vdso before installing the mapping
[safe/jmp/linux-2.6] / arch / x86 / vdso / vdso32-setup.c
index 1241f11..58bc00f 100644 (file)
@@ -338,6 +338,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
                }
        }
 
+       current->mm->context.vdso = (void *)addr;
+
        if (compat_uses_vma || !compat) {
                /*
                 * MAYWRITE to allow gdb to COW and set breakpoints
@@ -358,11 +360,13 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
                        goto up_fail;
        }
 
-       current->mm->context.vdso = (void *)addr;
        current_thread_info()->sysenter_return =
                VDSO32_SYMBOL(addr, SYSENTER_RETURN);
 
   up_fail:
+       if (ret)
+               current->mm->context.vdso = NULL;
+
        up_write(&mm->mmap_sem);
 
        return ret;