x86/fpu: Do not leak fpstate pointer on fork
authorThomas Gleixner <tglx@linutronix.de>
Wed, 13 Oct 2021 14:55:43 +0000 (16:55 +0200)
committerBorislav Petkov <bp@suse.de>
Thu, 21 Oct 2021 07:32:41 +0000 (09:32 +0200)
commitf0cbc8b3cdf7d1c724155cd9cecffe329bb96119
tree7a0ccb3d6ee636dbd3267b01c3d69946ae718d6c
parent2f27b5034244c4ebd70c90066defa771a99a5320
x86/fpu: Do not leak fpstate pointer on fork

If fork fails early then the copied task struct would carry the fpstate
pointer of the parent task.

Not a problem right now, but later when dynamically allocated buffers
are available, keeping the pointer might result in freeing the
parent's buffer. Set it to NULL which prevents that. If fork reaches
clone_thread(), the pointer will be correctly set to the new task
context.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211013145322.817101108@linutronix.de
arch/x86/kernel/process.c