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().
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.