Skip to contentSkip to conversation

KVM: selftests: Fix VM leak in early return

PATCH Applied Tharit Tangkijwanichakul 2 participants 2 messages Sep 6 – Sep 14

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

PATCH 1/1 KVM: selftests: Fix VM leak in early return

test_mmio_ease() returns early and skips the call to kvm_vm_free() when ID_AA64PFR1_EL1 is not available.

Use a goto so that the early return joins the common exit path.

Fixes a90aac553249 ("KVM: arm64: selftests: Test SEAs are taken to SError vector when EASE=1")

---
Tested on a Rock 5B (RK3588). ID_AA64PFR1_EL1.DF2 is not implemented, so test_mmio_ease() takes the skip path exercised by this fix.

---
 tools/testing/selftests/kvm/arm64/external_aborts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/kvm/arm64/external_aborts.c +2 -1
index d8fe17a6cc59..7836756a38a6 100644
@@ -339,7 +339,7 @@ static void test_mmio_ease(void)
 	pfr1 = vcpu_get_reg(vcpu, KVM_ARM64_SYS_REG(SYS_ID_AA64PFR1_EL1));
 	if (!SYS_FIELD_GET(ID_AA64PFR1_EL1, DF2, pfr1)) {
 		pr_debug("Skipping %s\n", __func__);
-		return;
+		goto done;
 	}
 
 	/*
@@ -356,6 +356,7 @@ static void test_mmio_ease(void)
 
 	vcpu_inject_sea(vcpu);
 	vcpu_run_expect_done(vcpu);
+done:
 	kvm_vm_free(vm);
 }
 
Signature · 1 line
2.47.3
maintainer Applied
#1 lore raw
Quoted 4 lines · Tharit Tangkijwanichakul

test_mmio_ease() returns early and skips the call to kvm_vm_free() when ID_AA64PFR1_EL1 is not available.

Use a goto so that the early return joins the common exit path.

Applied to next, thanks!

[1/1] KVM: selftests: Fix VM leak in early return

      commit: bb6c7d2bf564cdaa24b14764b7126f5cab45965a

Cheers,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.