All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Naveen N Rao <naveen@kernel.org>
Subject: [PATCH 2/2] KVM: SVM: Drop unnecessary avic_vm_destroy() call on init failure
Date: Thu, 25 Jun 2026 15:09:33 -0700	[thread overview]
Message-ID: <20260625220933.3357733-3-seanjc@google.com> (raw)
In-Reply-To: <20260625220933.3357733-1-seanjc@google.com>

Don't bother calling avic_vm_destroy() when allocating the logical ID table
fails, as there is nothing to clean up now that the physical ID table is
allocated later, on-demand at first vCPU creation.

For all intents and purposes, no functional change intended, as calling
avic_vm_destroy() is a big nop in this case.

Fixes: 54ffe74cc4ab ("KVM: SVM: Move AVIC Physical ID table allocation to vcpu_precreate()")
Cc: Naveen N Rao (AMD) <naveen@kernel.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/svm/avic.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index 6b100fb014a6..cd1761744e1d 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -336,7 +336,6 @@ void avic_vm_destroy(struct kvm *kvm)
 int avic_vm_init(struct kvm *kvm)
 {
 	unsigned long flags;
-	int err = -ENOMEM;
 	struct kvm_svm *kvm_svm = to_kvm_svm(kvm);
 	struct kvm_svm *k2;
 	u32 vm_id;
@@ -346,7 +345,7 @@ int avic_vm_init(struct kvm *kvm)
 
 	kvm_svm->avic_logical_id_table = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
 	if (!kvm_svm->avic_logical_id_table)
-		goto free_avic;
+		return -ENOMEM;
 
 	spin_lock_irqsave(&svm_vm_data_hash_lock, flags);
  again:
@@ -367,10 +366,6 @@ int avic_vm_init(struct kvm *kvm)
 	spin_unlock_irqrestore(&svm_vm_data_hash_lock, flags);
 
 	return 0;
-
-free_avic:
-	avic_vm_destroy(kvm);
-	return err;
 }
 
 static phys_addr_t avic_get_backing_page_address(struct vcpu_svm *svm)
-- 
2.55.0.rc0.799.gd6f94ed593-goog


  parent reply	other threads:[~2026-06-25 22:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25 22:09 [PATCH 0/2] KVM: SVM: Fix a (very) unlikely UAF for GA Log IRQs Sean Christopherson
2026-06-25 22:09 ` [PATCH 1/2] KVM: SVM: Remove VM from the GA Log notifier list before VM destruction Sean Christopherson
2026-06-25 22:26   ` sashiko-bot
2026-06-28 18:30     ` XIAO WU
2026-06-25 22:09 ` Sean Christopherson [this message]
2026-06-25 22:25   ` [PATCH 2/2] KVM: SVM: Drop unnecessary avic_vm_destroy() call on init failure sashiko-bot
2026-06-29 13:27   ` Naveen N Rao
2026-06-30  0:17     ` Sean Christopherson
2026-07-03 16:21       ` Naveen N Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260625220933.3357733-3-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naveen@kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.