Merge branch 'x86/tracehook' into x86-v28-for-linus-phase1
[pandora-kernel.git] / arch / x86 / kernel / signal_64.c
index d01e3f6..4d32487 100644 (file)
@@ -28,6 +28,7 @@
 #include <asm/ia32_unistd.h>
 #include <asm/mce.h>
 #include <asm/syscall.h>
+#include <asm/syscalls.h>
 #include "sigframe.h"
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
@@ -106,7 +107,16 @@ static inline int restore_i387(struct _fpstate __user *buf)
                clts();
                task_thread_info(current)->status |= TS_USEDFPU;
        }
-       return restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
+       err = restore_fpu_checking((__force struct i387_fxsave_struct *)buf);
+       if (unlikely(err)) {
+               /*
+                * Encountered an error while doing the restore from the
+                * user buffer, clear the fpu state.
+                */
+               clear_fpu(tsk);
+               clear_used_math();
+       }
+       return err;
 }
 
 /*