diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2013-09-27 04:04:41 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-09 15:24:26 -0500 |
commit | 2bf5861acf602fe6201ac1f82955ac7283e56b6f (patch) | |
tree | a9ce744c6ef2bd2b42ac4a54d712e4f2fe6e22f1 | |
parent | 79f783f05539479676406d3d42c3d86bd203f083 (diff) |
arm64: fix possible invalid FPSIMD initialization state
commit 6db83cea1c975b9a102e17def7d2795814e1ae2b upstream.
If context switching happens during executing fpsimd_flush_thread(),
stale value in FPSIMD registers will be saved into current thread's
fpsimd_state by fpsimd_thread_switch(). That may cause invalid
initialization state for the new process, so disable preemption
when executing fpsimd_flush_thread().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | arch/arm64/kernel/fpsimd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index e8b8357aedb4..2fa308e4a1fa 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c | |||
@@ -79,8 +79,10 @@ void fpsimd_thread_switch(struct task_struct *next) | |||
79 | 79 | ||
80 | void fpsimd_flush_thread(void) | 80 | void fpsimd_flush_thread(void) |
81 | { | 81 | { |
82 | preempt_disable(); | ||
82 | memset(¤t->thread.fpsimd_state, 0, sizeof(struct fpsimd_state)); | 83 | memset(¤t->thread.fpsimd_state, 0, sizeof(struct fpsimd_state)); |
83 | fpsimd_load_state(¤t->thread.fpsimd_state); | 84 | fpsimd_load_state(¤t->thread.fpsimd_state); |
85 | preempt_enable(); | ||
84 | } | 86 | } |
85 | 87 | ||
86 | /* | 88 | /* |