Messages in this thread Patch in this message | | | From | "Chang S. Bae" <> | Subject | [PATCH v11 01/29] x86/fpu/xstate: Fix the state copy function to the XSTATE buffer | Date | Fri, 1 Oct 2021 15:37:00 -0700 |
| |
Harden copy_uabi_to_xstate() so that it can handle the case where __raw_xsave() returns NULL. This does not happen in practice today, but theoretically could happen in the future.
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com> Reviewed-by: Len Brown <len.brown@intel.com> Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org --- Changes from v9: * Add as a new patch (moved from Patch11). (Borislav Petkov) --- arch/x86/kernel/fpu/xstate.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index c8def1b7f8fb..fc1d529547e6 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -1132,6 +1132,9 @@ static int copy_uabi_to_xstate(struct xregs_state *xsave, const void *kbuf, if (hdr.xfeatures & mask) { void *dst = __raw_xsave_addr(xsave, i); + if (!dst) + continue; + offset = xstate_offsets[i]; size = xstate_sizes[i]; -- 2.17.1
| |