]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: Skip VMSA init in sev_es_init_vmcb() if pointer is NULL
authorSean Christopherson <seanjc@google.com>
Fri, 25 Aug 2023 02:23:57 +0000 (19:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:28:07 +0000 (12:28 +0200)
commit60b5ef4cf82c866816564ef9d9294f5051352ef0
tree5fb1e400a8cd2ff2a36d75348011aa6384b5dff9
parent12645e623f287f60b72bca09941b10f5c2adf2fc
KVM: SVM: Skip VMSA init in sev_es_init_vmcb() if pointer is NULL

commit 1952e74da96fb3e48b72a2d0ece78c688a5848c1 upstream.

Skip initializing the VMSA physical address in the VMCB if the VMSA is
NULL, which occurs during intrahost migration as KVM initializes the VMCB
before copying over state from the source to the destination (including
the VMSA and its physical address).

In normal builds, __pa() is just math, so the bug isn't fatal, but with
CONFIG_DEBUG_VIRTUAL=y, the validity of the virtual address is verified
and passing in NULL will make the kernel unhappy.

Fixes: 6defa24d3b12 ("KVM: SEV: Init target VMCBs in sev_migrate_from")
Cc: stable@vger.kernel.org
Cc: Peter Gonda <pgonda@google.com>
Reviewed-by: Peter Gonda <pgonda@google.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
Link: https://lore.kernel.org/r/20230825022357.2852133-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/svm/sev.c