KVM: SEV: Return appropriate error codes if SEV-ES scratch setup fails
authorSean Christopherson <seanjc@google.com>
Tue, 9 Nov 2021 22:23:49 +0000 (22:23 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Dec 2021 08:04:54 +0000 (09:04 +0100)
commit7012eb0e522064432dcabd448fe5c3147f2ad4fd
tree6f0b8581a72129fa15dbed26c35c60215f429e50
parenta246d92dda9fa3ca3a79bd49d8b982b7c176b042
KVM: SEV: Return appropriate error codes if SEV-ES scratch setup fails

[ Upstream commit 75236f5f2299b502e4b9b267c1ce3bc14a222ceb ]

Return appropriate error codes if setting up the GHCB scratch area for an
SEV-ES guest fails.  In particular, returning -EINVAL instead of -ENOMEM
when allocating the kernel buffer could be confusing as userspace would
likely suspect a guest issue.

Fixes: 8f423a80d299 ("KVM: SVM: Support MMIO for an SEV-ES guest")
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20211109222350.2266045-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/svm/sev.c