diff options
Diffstat (limited to 'arch/x86/kernel/traps_32.c')
-rw-r--r-- | arch/x86/kernel/traps_32.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c index 8d136a73ce8e..471e694d6713 100644 --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c | |||
@@ -1148,9 +1148,22 @@ asmlinkage void math_state_restore(void) | |||
1148 | struct thread_info *thread = current_thread_info(); | 1148 | struct thread_info *thread = current_thread_info(); |
1149 | struct task_struct *tsk = thread->task; | 1149 | struct task_struct *tsk = thread->task; |
1150 | 1150 | ||
1151 | if (!tsk_used_math(tsk)) { | ||
1152 | local_irq_enable(); | ||
1153 | /* | ||
1154 | * does a slab alloc which can sleep | ||
1155 | */ | ||
1156 | if (init_fpu(tsk)) { | ||
1157 | /* | ||
1158 | * ran out of memory! | ||
1159 | */ | ||
1160 | do_group_exit(SIGKILL); | ||
1161 | return; | ||
1162 | } | ||
1163 | local_irq_disable(); | ||
1164 | } | ||
1165 | |||
1151 | clts(); /* Allow maths ops (or we recurse) */ | 1166 | clts(); /* Allow maths ops (or we recurse) */ |
1152 | if (!tsk_used_math(tsk)) | ||
1153 | init_fpu(tsk); | ||
1154 | restore_fpu(tsk); | 1167 | restore_fpu(tsk); |
1155 | thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */ | 1168 | thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */ |
1156 | tsk->fpu_counter++; | 1169 | tsk->fpu_counter++; |