Re: [PATCH] KVM: Remove kvm_debugfs_dir on kvm_init() error paths

From: Sean Christopherson

Date: Tue Jul 14 2026 - 15:37:15 EST


On Mon, 06 Jul 2026 17:59:06 +0800, leixiang wrote:
> 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().
>
> [...]

Applied to kvm-x86 generic, thanks!

[1/1] KVM: Remove kvm_debugfs_dir on kvm_init() error paths
https://github.com/kvm-x86/linux/commit/db3a46e200df

--
https://github.com/kvm-x86/linux/tree/next