lkml.org 
[lkml]   [2021]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[patch 12/21] x86/fpu: Do not leak fpstate pointer on fork
Date
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 parents
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>
---
arch/x86/kernel/process.c | 2 ++
1 file changed, 2 insertions(+)

--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -87,6 +87,8 @@ int arch_dup_task_struct(struct task_str
#ifdef CONFIG_VM86
dst->thread.vm86 = NULL;
#endif
+ /* Drop the copied pointer to current's fpstate */
+ dst->thread.fpu.fpstate = NULL;
return 0;
}

\
 
 \ /
  Last update: 2021-10-13 16:56    [W:0.322 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site