Merge commit 'v2.6.27-rc7' into x86/debug
[sfrench/cifs-2.6.git] / arch / x86 / kernel / traps_64.c
index 8b5b3b81d437e72f76a2a90cc6fd43089457a97e..7ffc8cff6cccf479eb20abbc25a8c554028896cf 100644 (file)
@@ -1130,7 +1130,14 @@ asmlinkage void math_state_restore(void)
        }
 
        clts();                         /* Allow maths ops (or we recurse) */
-       restore_fpu_checking(&me->thread.xstate->fxsave);
+       /*
+        * Paranoid restore. send a SIGSEGV if we fail to restore the state.
+        */
+       if (unlikely(restore_fpu_checking(&me->thread.xstate->fxsave))) {
+               stts();
+               force_sig(SIGSEGV, me);
+               return;
+       }
        task_thread_info(me)->status |= TS_USEDFPU;
        me->fpu_counter++;
 }