Commit a37d01ea authored by Al Viro's avatar Al Viro

x86: switch save_v86_state() to unsafe_put_user()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 77f3c616
...@@ -98,7 +98,6 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval) ...@@ -98,7 +98,6 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval)
struct task_struct *tsk = current; struct task_struct *tsk = current;
struct vm86plus_struct __user *user; struct vm86plus_struct __user *user;
struct vm86 *vm86 = current->thread.vm86; struct vm86 *vm86 = current->thread.vm86;
long err = 0;
/* /*
* This gets called from entry.S with interrupts disabled, but * This gets called from entry.S with interrupts disabled, but
...@@ -114,37 +113,30 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval) ...@@ -114,37 +113,30 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval)
set_flags(regs->pt.flags, VEFLAGS, X86_EFLAGS_VIF | vm86->veflags_mask); set_flags(regs->pt.flags, VEFLAGS, X86_EFLAGS_VIF | vm86->veflags_mask);
user = vm86->user_vm86; user = vm86->user_vm86;
if (!access_ok(user, vm86->vm86plus.is_vm86pus ? if (!user_access_begin(user, vm86->vm86plus.is_vm86pus ?
sizeof(struct vm86plus_struct) : sizeof(struct vm86plus_struct) :
sizeof(struct vm86_struct))) { sizeof(struct vm86_struct)))
pr_alert("could not access userspace vm86 info\n"); goto Efault;
do_exit(SIGSEGV);
} unsafe_put_user(regs->pt.bx, &user->regs.ebx, Efault_end);
unsafe_put_user(regs->pt.cx, &user->regs.ecx, Efault_end);
put_user_try { unsafe_put_user(regs->pt.dx, &user->regs.edx, Efault_end);
put_user_ex(regs->pt.bx, &user->regs.ebx); unsafe_put_user(regs->pt.si, &user->regs.esi, Efault_end);
put_user_ex(regs->pt.cx, &user->regs.ecx); unsafe_put_user(regs->pt.di, &user->regs.edi, Efault_end);
put_user_ex(regs->pt.dx, &user->regs.edx); unsafe_put_user(regs->pt.bp, &user->regs.ebp, Efault_end);
put_user_ex(regs->pt.si, &user->regs.esi); unsafe_put_user(regs->pt.ax, &user->regs.eax, Efault_end);
put_user_ex(regs->pt.di, &user->regs.edi); unsafe_put_user(regs->pt.ip, &user->regs.eip, Efault_end);
put_user_ex(regs->pt.bp, &user->regs.ebp); unsafe_put_user(regs->pt.cs, &user->regs.cs, Efault_end);
put_user_ex(regs->pt.ax, &user->regs.eax); unsafe_put_user(regs->pt.flags, &user->regs.eflags, Efault_end);
put_user_ex(regs->pt.ip, &user->regs.eip); unsafe_put_user(regs->pt.sp, &user->regs.esp, Efault_end);
put_user_ex(regs->pt.cs, &user->regs.cs); unsafe_put_user(regs->pt.ss, &user->regs.ss, Efault_end);
put_user_ex(regs->pt.flags, &user->regs.eflags); unsafe_put_user(regs->es, &user->regs.es, Efault_end);
put_user_ex(regs->pt.sp, &user->regs.esp); unsafe_put_user(regs->ds, &user->regs.ds, Efault_end);
put_user_ex(regs->pt.ss, &user->regs.ss); unsafe_put_user(regs->fs, &user->regs.fs, Efault_end);
put_user_ex(regs->es, &user->regs.es); unsafe_put_user(regs->gs, &user->regs.gs, Efault_end);
put_user_ex(regs->ds, &user->regs.ds); unsafe_put_user(vm86->screen_bitmap, &user->screen_bitmap, Efault_end);
put_user_ex(regs->fs, &user->regs.fs);
put_user_ex(regs->gs, &user->regs.gs); user_access_end();
put_user_ex(vm86->screen_bitmap, &user->screen_bitmap);
} put_user_catch(err);
if (err) {
pr_alert("could not access userspace vm86 info\n");
do_exit(SIGSEGV);
}
preempt_disable(); preempt_disable();
tsk->thread.sp0 = vm86->saved_sp0; tsk->thread.sp0 = vm86->saved_sp0;
...@@ -159,6 +151,13 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval) ...@@ -159,6 +151,13 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval)
lazy_load_gs(vm86->regs32.gs); lazy_load_gs(vm86->regs32.gs);
regs->pt.ax = retval; regs->pt.ax = retval;
return;
Efault_end:
user_access_end();
Efault:
pr_alert("could not access userspace vm86 info\n");
do_exit(SIGSEGV);
} }
static void mark_screen_rdonly(struct mm_struct *mm) static void mark_screen_rdonly(struct mm_struct *mm)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment