diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2016-06-09 16:34:02 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2016-06-23 16:41:57 -0400 |
commit | a2982cc922c3068783eb9a1f77a5626a1ec36a1f (patch) | |
tree | 61ccc6ad01f8804d5290ae4565ba8d4238bf648a /include/linux/fs.h | |
parent | 3ee690143c3c99f6c0e83f08ff17556890bc6027 (diff) |
vfs: Generalize filesystem nodev handling.
Introduce a function may_open_dev that tests MNT_NODEV and a new
superblock flab SB_I_NODEV. Use this new function in all of the
places where MNT_NODEV was previously tested.
Add the new SB_I_NODEV s_iflag to proc, sysfs, and mqueuefs as those
filesystems should never support device nodes, and a simple superblock
flags makes that very hard to get wrong. With SB_I_NODEV set if any
device nodes somehow manage to show up on on a filesystem those
device nodes will be unopenable.
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 9eef64f23a75..e05983170d23 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1327,6 +1327,7 @@ struct mm_struct; | |||
1327 | /* sb->s_iflags */ | 1327 | /* sb->s_iflags */ |
1328 | #define SB_I_CGROUPWB 0x00000001 /* cgroup-aware writeback enabled */ | 1328 | #define SB_I_CGROUPWB 0x00000001 /* cgroup-aware writeback enabled */ |
1329 | #define SB_I_NOEXEC 0x00000002 /* Ignore executables on this fs */ | 1329 | #define SB_I_NOEXEC 0x00000002 /* Ignore executables on this fs */ |
1330 | #define SB_I_NODEV 0x00000004 /* Ignore devices on this fs */ | ||
1330 | 1331 | ||
1331 | /* sb->s_iflags to limit user namespace mounts */ | 1332 | /* sb->s_iflags to limit user namespace mounts */ |
1332 | #define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */ | 1333 | #define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */ |
@@ -1602,6 +1603,7 @@ extern int vfs_whiteout(struct inode *, struct dentry *); | |||
1602 | */ | 1603 | */ |
1603 | extern void inode_init_owner(struct inode *inode, const struct inode *dir, | 1604 | extern void inode_init_owner(struct inode *inode, const struct inode *dir, |
1604 | umode_t mode); | 1605 | umode_t mode); |
1606 | extern bool may_open_dev(const struct path *path); | ||
1605 | /* | 1607 | /* |
1606 | * VFS FS_IOC_FIEMAP helper definitions. | 1608 | * VFS FS_IOC_FIEMAP helper definitions. |
1607 | */ | 1609 | */ |