summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/xsave.c
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2012-08-25 01:12:57 +0400
committerH. Peter Anvin <hpa@linux.intel.com>2012-09-19 02:52:05 +0400
commite962591749dfd4df9fea2c530ed7a3cfed50e5aa (patch)
tree9465f4181ef0431c03c1dcd92674b028f37a9d3e /arch/x86/kernel/xsave.c
parent72a671ced66db6d1c2bfff1c930a101ac8d08204 (diff)
downloadlinux-e962591749dfd4df9fea2c530ed7a3cfed50e5aa.tar.xz
x86, fpu: drop_fpu() before restoring new state from sigframe
No need to save the state with unlazy_fpu(), that is about to get overwritten by the state from the signal frame. Instead use drop_fpu() and continue to restore the new state. Also fold the stop_fpu_preload() into drop_fpu(). Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Link: http://lkml.kernel.org/r/1345842782-24175-2-git-send-email-suresh.b.siddha@intel.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/xsave.c')
-rw-r--r--arch/x86/kernel/xsave.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 0923d27f23df..07ddc870640b 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -382,16 +382,14 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size)
struct xsave_struct *xsave = &tsk->thread.fpu.state->xsave;
struct user_i387_ia32_struct env;
- stop_fpu_preload(tsk);
- unlazy_fpu(tsk);
+ drop_fpu(tsk);
if (__copy_from_user(xsave, buf_fx, state_size) ||
- __copy_from_user(&env, buf, sizeof(env))) {
- drop_fpu(tsk);
+ __copy_from_user(&env, buf, sizeof(env)))
return -1;
- }
sanitize_restored_xstate(tsk, &env, xstate_bv, fx_only);
+ set_used_math();
} else {
/*
* For 64-bit frames and 32-bit fsave frames, restore the user