linux/virt/kvm
leixiang b31e7c24b4 KVM: Remove kvm_debugfs_dir on kvm_init() error paths
kvm_init_debug() runs before several steps that can fail
(kvm_vfio_ops_init(), kvm_gmem_init(), kvm_init_virtualization() and
misc_register()), but none of the corresponding error labels remove the
"kvm" debugfs directory.  Any failure after kvm_init_debug() therefore
leaks the directory and its stat files for the lifetime of the boot.

kvm_exit() already calls debugfs_remove_recursive(kvm_debugfs_dir); add
the same at the err_vfio label, whose fall-through covers every path
taken after kvm_init_debug().

Fixes: 2b01281273 ("KVM: Register /dev/kvm as the _very_ last thing during initialization")
Signed-off-by: leixiang <leixiang@kylinos.cn>
Link: https://patch.msgid.link/20260706095910.39798-1-leixiang@kylinos.cn
Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-07-08 13:41:15 -07:00
..
async_pf.c KVM: remove redundant __GFP_NOWARN 2025-08-19 11:51:13 -07:00
async_pf.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 504 2019-06-19 17:09:56 +02:00
binary_stats.c KVM: Remove subtle "struct kvm_stats_desc" pseudo-overlay 2026-01-08 10:40:48 -08:00
coalesced_mmio.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
coalesced_mmio.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dirty_ring.c KVM: Reject wrapped offset in kvm_reset_dirty_gfn() 2026-05-12 22:16:16 +02:00
eventfd.c KVM: Replace guest-triggerable BUG_ON() in ioeventfd datamatch with get_unaligned() 2026-06-24 11:25:14 +02:00
guest_memfd.c KVM SEV changes for 7.2 2026-06-12 10:13:03 +02:00
irqchip.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
Kconfig KVM: remove CONFIG_KVM_GENERIC_MMU_NOTIFIER 2026-02-28 15:31:35 +01:00
kvm_main.c KVM: Remove kvm_debugfs_dir on kvm_init() error paths 2026-07-08 13:41:15 -07:00
kvm_mm.h KVM: guest_memfd: Treat memslot binding offset+size as unsigned values 2026-06-03 05:39:24 -07:00
Makefile.kvm KVM: Rename CONFIG_KVM_PRIVATE_MEM to CONFIG_KVM_GUEST_MEMFD 2025-08-27 04:34:59 -04:00
pfncache.c KVM: pfncache: Precisely track refcounted pages 2024-10-25 12:57:59 -04:00
vfio.c KVM: VFIO: update coherency only if file was deleted 2026-05-13 11:12:40 -07:00
vfio.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00