x86/fpu: Don't use current->mm to check for a kthread
authorChristoph Hellwig <hch@lst.de>
Tue, 4 Jun 2019 17:54:12 +0000 (19:54 +0200)
committerBorislav Petkov <bp@suse.de>
Thu, 13 Jun 2019 18:57:49 +0000 (20:57 +0200)
commit8d3289f2fa1e0c7e2f72c7352f1efb75d2ad7c76
treed785c183839b1f28213f9061a94a4462c9681483
parent71ab8323cc357c68985a2d6fc6cfc22b1dbbc1c3
x86/fpu: Don't use current->mm to check for a kthread

current->mm can be non-NULL if a kthread calls use_mm(). Check for
PF_KTHREAD instead to decide when to store user mode FP state.

Fixes: 2722146eb784 ("x86/fpu: Remove fpu->initialized")
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Aubrey Li <aubrey.li@intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Nicolai Stange <nstange@suse.de>
Cc: Rik van Riel <riel@surriel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20190604175411.GA27477@lst.de
arch/x86/include/asm/fpu/internal.h
arch/x86/kernel/fpu/core.c