Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / x86 / kernel / xsave.c
index 0a5b04aa98f1e17b7b2d1d4c4e1ec5db37f590d3..c5ee17e8c6d95628809825073d7681db6d842943 100644 (file)
@@ -89,7 +89,7 @@ int save_i387_xstate(void __user *buf)
 
        if (!used_math())
                return 0;
-       clear_used_math(); /* trigger finit */
+
        if (task_thread_info(tsk)->status & TS_USEDFPU) {
                /*
                 * Start with clearing the user buffer. This will present a
@@ -114,6 +114,8 @@ int save_i387_xstate(void __user *buf)
                        return -1;
        }
 
+       clear_used_math(); /* trigger finit */
+
        if (task_thread_info(tsk)->status & TS_XSAVE) {
                struct _fpstate __user *fx = buf;
                struct _xstate __user *x = buf;