x86/fpu: Clean up fpregs_set()
authorAndy Lutomirski <luto@kernel.org>
Wed, 23 Jun 2021 12:01:41 +0000 (14:01 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 15:49:46 +0000 (17:49 +0200)
commitda53f60bb86e60830932926cf1093953a811912c
tree624407d289b53d65f0526b10f53918b21755ee33
parent145e9e0d8c6fada4a40f9fc65b34658077874d9c
x86/fpu: Clean up fpregs_set()

fpregs_set() has unnecessary complexity to support short or nonzero-offset
writes and to handle the case in which a copy from userspace overwrites
some of the target buffer and then fails.  Support for partial writes is
useless -- just require that the write has offset 0 and the correct size,
and copy into a temporary kernel buffer to avoid clobbering the state if
the user access fails.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121452.710467587@linutronix.de
arch/x86/kernel/fpu/regset.c