x86/fpu: drop_fpu() should not assume that tsk equals current

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.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: <stable@vger.kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pekka Riikonen <priikone@iki.fi>
Cc: Suresh Siddha <sbsiddha@gmail.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/20150309171041.GB11388@redhat.com
Signed-off-by: Borislav Petkov <bp@suse.de>
1 file changed