x86/fpu: Drop_fpu() should not assume that tsk equals current
authorOleg Nesterov <oleg@redhat.com>
Fri, 13 Mar 2015 08:53:10 +0000 (09:53 +0100)
committerSasha Levin <sasha.levin@oracle.com>
Sat, 28 Mar 2015 14:03:58 +0000 (10:03 -0400)
commit1b6bd91982a1f8b67684a1886dea0373c26e73c2
treef95e1e2271543a569644fcb14c3d6a7016bf8717
parent1a29c27a0feda99289ddc41cb5dfbe010d37d374
x86/fpu: Drop_fpu() should not assume that tsk equals current

[ Upstream commit f4c3686386393c120710dd34df2a74183ab805fd ]

drop_fpu() does clear_used_math() and usually this is correct
because tsk == current.

However switch_fpu_finish()->restore_fpu_checking() is called before
__switch_to() updates the "current_task" variable. If it fails,
we will wrongly clear the PF_USED_MATH flag of the previous task.

So use clear_stopped_child_used_math() instead.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: <stable@vger.kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pekka Riikonen <priikone@iki.fi>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Suresh Siddha <sbsiddha@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20150309171041.GB11388@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
arch/x86/include/asm/fpu-internal.h