]> 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)
commit4b710dd7b8783024ea1aab048b5723d962db1de2
tree7a0ccb3d6ee636dbd3267b01c3d69946ae718d6c
parent153c5ae9dbf0ba11d74ab03f5d196c06782d40f0
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