Skip to content
Snippets Groups Projects
Commit f4ac998d authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov
Browse files

KVM: Don't create VM debugfs files outside of the VM directory

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2074832



commit a44a4cc1
Author: Oliver Upton <oupton@google.com>
Date:   Wed Apr 6 23:56:13 2022 +0000

    KVM: Don't create VM debugfs files outside of the VM directory

    Unfortunately, there is no guarantee that KVM was able to instantiate a
    debugfs directory for a particular VM. To that end, KVM shouldn't even
    attempt to create new debugfs files in this case. If the specified
    parent dentry is NULL, debugfs_create_file() will instantiate files at
    the root of debugfs.

    For arm64, it is possible to create the vgic-state file outside of a
    VM directory, the file is not cleaned up when a VM is destroyed.
    Nonetheless, the corresponding struct kvm is freed when the VM is
    destroyed.

    Nip the problem in the bud for all possible errant debugfs file
    creations by initializing kvm->debugfs_dentry to -ENOENT. In so doing,
    debugfs_create_file() will fail instead of creating the file in the root
    directory.

    Cc: stable@kernel.org
    Fixes: 929f45e3 ("kvm: no need to check return value of debugfs_create functions")
Signed-off-by: default avatarOliver Upton <oupton@google.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20220406235615.1447180-2-oupton@google.com



Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
parent b104c613
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment