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>
This commit is contained in:
@@ -1327,6 +1327,7 @@ struct mm_struct;
|
||||
/* sb->s_iflags */
|
||||
#define SB_I_CGROUPWB 0x00000001 /* cgroup-aware writeback enabled */
|
||||
#define SB_I_NOEXEC 0x00000002 /* Ignore executables on this fs */
|
||||
#define SB_I_NODEV 0x00000004 /* Ignore devices on this fs */
|
||||
|
||||
/* sb->s_iflags to limit user namespace mounts */
|
||||
#define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */
|
||||
@@ -1602,6 +1603,7 @@ extern int vfs_whiteout(struct inode *, struct dentry *);
|
||||
*/
|
||||
extern void inode_init_owner(struct inode *inode, const struct inode *dir,
|
||||
umode_t mode);
|
||||
extern bool may_open_dev(const struct path *path);
|
||||
/*
|
||||
* VFS FS_IOC_FIEMAP helper definitions.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user