From: Oleg Nesterov <o...@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit df24fb859a4e200d9324e2974229fbb7adf00aef upstream.

Add preempt_disable() + preempt_enable() around math_state_restore() in
__restore_xstate_sig(). Otherwise __switch_to() after __thread_fpu_begin()
can overwrite fpu->state we are going to restore.

Signed-off-by: Oleg Nesterov <o...@redhat.com>
Link: http://lkml.kernel.org/r/20140902175717.ga21...@redhat.com
Reviewed-by: Suresh Siddha <sbsid...@gmail.com>
Signed-off-by: H. Peter Anvin <h...@linux.intel.com>
Signed-off-by: Jiri Slaby <jsl...@suse.cz>
---
 arch/x86/kernel/xsave.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 422fd8223470..7305625c2767 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -399,8 +399,11 @@ int __restore_xstate_sig(void __user *buf, void __user 
*buf_fx, int size)
                        set_used_math();
                }
 
-               if (use_eager_fpu())
+               if (use_eager_fpu()) {
+                       preempt_disable();
                        math_state_restore();
+                       preempt_enable();
+               }
 
                return err;
        } else {
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to