]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitb28fc164ea9d777a5bb64f6eeab89ed67e88d70b
tree7a0ccb3d6ee636dbd3267b01c3d69946ae718d6c
parenta04652b539851707a44c6aae29c058b7cf7c69a5
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