}
}
-static int kvm_create_vm_debugfs(struct kvm *kvm, int fd)
+static int kvm_create_vm_debugfs(struct kvm *kvm, const char *fdname)
{
static DEFINE_MUTEX(kvm_debugfs_lock);
struct dentry *dent;
if (!debugfs_initialized())
return 0;
- snprintf(dir_name, sizeof(dir_name), "%d-%d", task_pid_nr(current), fd);
+ snprintf(dir_name, sizeof(dir_name), "%d-%s", task_pid_nr(current), fdname);
mutex_lock(&kvm_debugfs_lock);
dent = debugfs_lookup(dir_name, kvm_debugfs_dir);
if (dent) {
static int kvm_dev_ioctl_create_vm(unsigned long type)
{
+ char fdname[ITOA_MAX_LEN + 1];
int r, fd;
struct kvm *kvm;
struct file *file;
if (fd < 0)
return fd;
+ snprintf(fdname, sizeof(fdname), "%d", fd);
+
kvm = kvm_create_vm(type);
if (IS_ERR(kvm)) {
r = PTR_ERR(kvm);
* cases it will be called by the final fput(file) and will take
* care of doing kvm_put_kvm(kvm).
*/
- if (kvm_create_vm_debugfs(kvm, fd) < 0) {
+ if (kvm_create_vm_debugfs(kvm, fdname) < 0) {
fput(file);
r = -ENOMEM;
goto put_fd;