Commit a22c1627 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] i387: handle copy_from_user() error

From: "Randy.Dunlap" <rddunlap@osdl.org>
      Eugene TEO <eugeneteo@eugeneteo.net>
parent 29d82b14
...@@ -451,15 +451,18 @@ int get_fpxregs( struct user_fxsr_struct __user *buf, struct task_struct *tsk ) ...@@ -451,15 +451,18 @@ int get_fpxregs( struct user_fxsr_struct __user *buf, struct task_struct *tsk )
int set_fpxregs( struct task_struct *tsk, struct user_fxsr_struct __user *buf ) int set_fpxregs( struct task_struct *tsk, struct user_fxsr_struct __user *buf )
{ {
int ret = 0;
if ( cpu_has_fxsr ) { if ( cpu_has_fxsr ) {
__copy_from_user( &tsk->thread.i387.fxsave, buf, if (__copy_from_user( &tsk->thread.i387.fxsave, buf,
sizeof(struct user_fxsr_struct) ); sizeof(struct user_fxsr_struct) ))
ret = -EFAULT;
/* mxcsr bit 6 and 31-16 must be zero for security reasons */ /* mxcsr bit 6 and 31-16 must be zero for security reasons */
tsk->thread.i387.fxsave.mxcsr &= 0xffbf; tsk->thread.i387.fxsave.mxcsr &= 0xffbf;
return 0;
} else { } else {
return -EIO; ret = -EIO;
} }
return ret;
} }
/* /*
......
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