CVE-2026-89909: LoongArch: KVM: Free init resources if kvm_init() fails
In the Linux kernel, the following vulnerability has been resolved:
LoongArch: KVM: Free init resources if kvminit() fails
kvmloongarchinit() calls kvmloongarchenvinit() to allocate the per-CPU kvmcontext (vmcs) and kvmloongarchops and to register the perf callbacks, and then calls kvminit(). If kvminit() fails its result is returned directly, but since moduleinit() does not run the moduleexit() stuff on failure, so kvmloongarchenvexit() is never called and those resources are leaked.
So call kvmloongarchenvexit() when kvminit() fails, matching the teardown-on-failure pattern used by riscvkvminit().
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.115-2Fixed in 7.2.12-1Fixed in 7.2.15-1 - Upgrade
Upgrade
debian/linux-6.12to a version that resolves this vulnerability.Fixed in 6.12.113-1~deb12u1 - Upgrade
Upgrade
ubuntu/linux-hwe-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-42.42~24.04.1 - Upgrade
Upgrade
ubuntu/linux-riscv-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-42.42.1~24.04.1 - Upgrade
Upgrade
ubuntu/linuxto a version that resolves this vulnerability.Fixed in 7.0.0-42.42 - Upgrade
Upgrade
ubuntu/linux-awsto a version that resolves this vulnerability.Fixed in 7.0.0-1016.17 - Upgrade
Upgrade
ubuntu/linux-gcpto a version that resolves this vulnerability.Fixed in 7.0.0-1016.18 - Upgrade
Upgrade
ubuntu/linux-ibmto a version that resolves this vulnerability.Fixed in 7.0.0-1017.17 - Upgrade
Upgrade
ubuntu/linux-oem-7.0to a version that resolves this vulnerability.Fixed in 7.0.0-1017.17 - Upgrade
Upgrade
ubuntu/linux-oracleto a version that resolves this vulnerability.Fixed in 7.0.0-1015.16 - Upgrade
Upgrade
ubuntu/linux-riscvto a version that resolves this vulnerability.Fixed in 7.0.0-42.42.1 - Compensating control
Update kvm_loongarch_init() to call kvm_loongarch_env_exit() when kvm_init() fails, freeing the per-CPU kvm_context (vmcs), kvm_loongarch_ops, and registered perf callbacks.
Event History
Frequently Asked Questions
Under what condition does the resource leak occur?
The leak occurs when the LoongArch KVM module has completed its environment initialization but kvm_init() subsequently fails. In that failure path, the module exit routine is not run automatically.
What resources can remain allocated after the failed initialization?
The affected initialization allocates per-CPU kvm_context (vmcs) data and kvm_loongarch_ops, and registers perf callbacks. These resources were not released when kvm_init() failed.
What does the fix change?
The fix calls kvm_loongarch_env_exit() when kvm_init() returns an error. This tears down the initialization resources on failure.