Skip to contentSkip to conversation

KVM: X86: conditionally call the release operation of memslot rmap

PATCH Superseded [email protected] 1 participant 1 message Jul 23, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: X86: conditionally call the release operation of memslot rmap

From: Peng Hao <[email protected]>

memslot_rmap_alloc is called when kvm_memslot_have_rmaps is enabled, so memslot_rmap_free in the exception process should also be called under the same conditions.

---
 arch/x86/kvm/x86.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/x86.c +2 -1
index af6c8cf6a37a..00a1d96699b8 100644
@@ -12947,7 +12947,8 @@ static int kvm_alloc_memslot_metadata(struct kvm *kvm,
 	return 0;
 
 out_free:
-	memslot_rmap_free(slot);
+	if (kvm_memslots_have_rmaps(kvm))
+		memslot_rmap_free(slot);
 
 	for (i = 1; i < KVM_NR_PAGE_SIZES; ++i) {
 		vfree(slot->arch.lpage_info[i - 1]);
Signature · 1 line
2.27.0