summary refs log tree commit diff
path: root/fs/debugfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-12 20:52:16 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-12 20:52:16 -0700
commitf5b7769eb0400ec5217a47e41148a9f816ca1f9f (patch)
tree2523ae64572026769c2d362a5b7e18fff35d49f7 /fs/debugfs
parentdbee3d02458b129b847c21f5fa60baba3eafc6f7 (diff)
downloadlinux-f5b7769eb0400ec5217a47e41148a9f816ca1f9f.tar.gz
Revert "debugfs: inode: debugfs_create_dir uses mode permission from parent"
This reverts commit 95cde3c59966f6371b6bcd9e4e2da2ba64ee9775.

The commit had good intentions, but it breaks kvm-tool and qemu-kvm.

With it in place, "lkvm run" just fails with

  Error: KVM_CREATE_VM ioctl
  Warning: Failed init: kvm__init

which isn't a wonderful error message, but bisection pinpointed the
problematic commit.

The problem is almost certainly due to the special kvm debugfs entries
created dynamically by kvm under /sys/kernel/debug/kvm/.  See
kvm_create_vm_debugfs()

Bisected-and-reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Wanpeng Li <kernellwp@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/debugfs')
-rw-r--r--fs/debugfs/inode.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index a913b12fc7f8..13b01351dd1c 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -512,9 +512,7 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
 	if (unlikely(!inode))
 		return failed_creating(dentry);
 
-	if (!parent)
-		parent = debugfs_mount->mnt_root;
-	inode->i_mode = S_IFDIR | ((d_inode(parent)->i_mode & 0770));
+	inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
 	inode->i_op = &simple_dir_inode_operations;
 	inode->i_fop = &simple_dir_operations;