Skip to content

Commit fdd5883

Browse files
committed
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: Tom Lendacky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 0aa6b90 commit fdd5883

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/x86/kvm/svm/sev.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,8 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
259259
if (kvm->created_vcpus)
260260
return -EINVAL;
261261

262-
ret = -EBUSY;
263262
if (unlikely(sev->active))
264-
return ret;
263+
return -EINVAL;
265264

266265
sev->active = true;
267266
sev->es_active = argp->id == KVM_SEV_ES_INIT;

0 commit comments

Comments
 (0)