Commit cc50a07a authored by Eric W. Biederman's avatar Eric W. Biederman

userns: Remove the now unnecessary FS_USERNS_DEV_MOUNT flag

Now that SB_I_NODEV controls the nodev behavior devpts can just clear
this flag during mount.  Simplifying the code and making it easier
to audit how the code works.  While still preserving the invariant
that s_iflags is only modified during mount.
Acked-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent 67690f93
...@@ -396,6 +396,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent) ...@@ -396,6 +396,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
{ {
struct inode *inode; struct inode *inode;
s->s_iflags &= ~SB_I_NODEV;
s->s_blocksize = 1024; s->s_blocksize = 1024;
s->s_blocksize_bits = 10; s->s_blocksize_bits = 10;
s->s_magic = DEVPTS_SUPER_MAGIC; s->s_magic = DEVPTS_SUPER_MAGIC;
...@@ -480,7 +481,7 @@ static struct file_system_type devpts_fs_type = { ...@@ -480,7 +481,7 @@ static struct file_system_type devpts_fs_type = {
.name = "devpts", .name = "devpts",
.mount = devpts_mount, .mount = devpts_mount,
.kill_sb = devpts_kill_sb, .kill_sb = devpts_kill_sb,
.fs_flags = FS_USERNS_MOUNT | FS_USERNS_DEV_MOUNT, .fs_flags = FS_USERNS_MOUNT,
}; };
/* /*
......
...@@ -206,8 +206,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, ...@@ -206,8 +206,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags,
init_waitqueue_head(&s->s_writers.wait_unfrozen); init_waitqueue_head(&s->s_writers.wait_unfrozen);
s->s_bdi = &noop_backing_dev_info; s->s_bdi = &noop_backing_dev_info;
s->s_flags = flags; s->s_flags = flags;
if ((s->s_user_ns != &init_user_ns) && if (s->s_user_ns != &init_user_ns)
!(type->fs_flags & FS_USERNS_DEV_MOUNT))
s->s_iflags |= SB_I_NODEV; s->s_iflags |= SB_I_NODEV;
INIT_HLIST_NODE(&s->s_instances); INIT_HLIST_NODE(&s->s_instances);
INIT_HLIST_BL_HEAD(&s->s_anon); INIT_HLIST_BL_HEAD(&s->s_anon);
......
...@@ -2022,7 +2022,6 @@ struct file_system_type { ...@@ -2022,7 +2022,6 @@ struct file_system_type {
#define FS_BINARY_MOUNTDATA 2 #define FS_BINARY_MOUNTDATA 2
#define FS_HAS_SUBTYPE 4 #define FS_HAS_SUBTYPE 4
#define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */
#define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */
#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
struct dentry *(*mount) (struct file_system_type *, int, struct dentry *(*mount) (struct file_system_type *, int,
const char *, void *); const char *, void *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment