Commit fdd58834 authored by Sean Christopherson's avatar Sean Christopherson

KVM: SVM: Return -EINVAL instead of -EBUSY on attempt to re-init SEV/SEV-ES

Return -EINVAL instead of -EBUSY if userspace attempts KVM_SEV{,ES}_INIT
on a VM that already has SEV active.  Returning -EBUSY is nonsencial as
it's impossible to deactivate SEV without destroying the VM, i.e. the VM
isn't "busy" in any sane sense of the word, and the odds of any userspace
wanting exactly -EBUSY on a userspace bug are minuscule.
Reviewed-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20240131235609.4161407-5-seanjc@google.comSigned-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 0aa6b90e
...@@ -259,9 +259,8 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp) ...@@ -259,9 +259,8 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
if (kvm->created_vcpus) if (kvm->created_vcpus)
return -EINVAL; return -EINVAL;
ret = -EBUSY;
if (unlikely(sev->active)) if (unlikely(sev->active))
return ret; return -EINVAL;
sev->active = true; sev->active = true;
sev->es_active = argp->id == KVM_SEV_ES_INIT; sev->es_active = argp->id == KVM_SEV_ES_INIT;
......
Markdown is supported
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