]> err.no Git - linux-2.6/blobdiff - arch/x86/kernel/traps_64.c
Merge git://git.infradead.org/~dedekind/ubi-2.6
[linux-2.6] / arch / x86 / kernel / traps_64.c
index dc0cb497eec38d4a142d274f6eac7764b6ce6560..adff76ea97c4732de4b7766272c8b6ad26ace478 100644 (file)
@@ -1124,10 +1124,23 @@ asmlinkage void __attribute__((weak)) mce_threshold_interrupt(void)
 asmlinkage void math_state_restore(void)
 {
        struct task_struct *me = current;
-       clts();                 /* Allow maths ops (or we recurse) */
 
-       if (!used_math())
-               init_fpu(me);
+       if (!used_math()) {
+               local_irq_enable();
+               /*
+                * does a slab alloc which can sleep
+                */
+               if (init_fpu(me)) {
+                       /*
+                        * ran out of memory!
+                        */
+                       do_group_exit(SIGKILL);
+                       return;
+               }
+               local_irq_disable();
+       }
+
+       clts();                 /* Allow maths ops (or we recurse) */
        restore_fpu_checking(&me->thread.xstate->fxsave);
        task_thread_info(me)->status |= TS_USEDFPU;
        me->fpu_counter++;