В ядре Linux была устранена следующая уязвимость: LoongArch: KVM: свободные ресурсы init, если kvm_init() терпит неудачу kvm_loongarch_init() вызывает kvm_loongarch_env_init() для выделения per-CPU kvm_context (vmcs) и kvm_loongarch_ops и для регистрации perf callbacks, а затем вызывает kvm_init(). Если kvm_init() терпит неудачу, его результат возвращается напрямую, но так как module_init() не запускает module_exit() материал при сбое, поэтому kvm_loongarch_env_exit() никогда не вызывается, и эти ресурсы просачиваются. Поэтому вызывайте kvm_loongarch_env_exit(), когда kvm_init() выходит из строя, соответствуя шаблону teardown-on-failure, используемому riscv_kvm_init().
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: LoongArch: KVM: Free init resources if kvm_init() fails kvm_loongarch_init() calls kvm_loongarch_env_init() to allocate the per-CPU kvm_context (vmcs) and kvm_loongarch_ops and to register the perf callbacks, and then calls kvm_init(). If kvm_init() fails its result is returned directly, but since module_init() does not run the module_exit() stuff on failure, so kvm_loongarch_env_exit() is never called and those resources are leaked. So call kvm_loongarch_env_exit() when kvm_init() fails, matching the teardown-on-failure pattern used by riscv_kvm_init().