diff options
author | Oliver Upton <[email protected]> | 2022-04-06 23:56:13 +0000 |
---|---|---|
committer | Marc Zyngier <[email protected]> | 2022-04-07 08:46:13 +0100 |
commit | a44a4cc1c969afec97dbb2aedaf6f38eaa6253bb (patch) | |
tree | 9d17a264e3770296f052f2bb4419ad218632232d /lib/memory-notifier-error-inject.c | |
parent | 02de9331c4d0c6bddac9c5fa66d91f70adf8612b (diff) |
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: [email protected]
Fixes: 929f45e32499 ("kvm: no need to check return value of debugfs_create functions")
Signed-off-by: Oliver Upton <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'lib/memory-notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions