Skip to content
Commit 2fd8eb4a authored by Yandong Zhao's avatar Yandong Zhao Committed by Will Deacon
Browse files

arm64: neon: Fix function may_use_simd() return error status

It does not matter if the caller of may_use_simd() migrates to
another cpu after the call, but it is still important that the
kernel_neon_busy percpu instance that is read matches the cpu the
task is running on at the time of the read.

This means that raw_cpu_read() is not sufficient.  kernel_neon_busy
may appear true if the caller migrates during the execution of
raw_cpu_read() and the next task to be scheduled in on the initial
cpu calls kernel_neon_begin().

This patch replaces raw_cpu_read() with this_cpu_read() to protect
against this race.

Cc: <stable@vger.kernel.org>
Fixes: cb84d11e

 ("arm64: neon: Remove support for nested or hardirq kernel-mode NEON")
Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: default avatarDave Martin <Dave.Martin@arm.com>
Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarYandong Zhao <yandong77520@gmail.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 96f95a17
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment