summaryrefslogtreecommitdiff
path: root/fs/fs_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fs_context.c')
-rw-r--r--fs/fs_context.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/fs_context.c b/fs/fs_context.c
index a47ccd5a4a78..746a5871959c 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -662,6 +662,11 @@ static int legacy_get_tree(struct fs_context *fc)
struct super_block *sb;
struct dentry *root;
+ if (!(fc->sb_flags & (SB_KERNMOUNT|SB_SUBMOUNT))) {
+ if (!mount_capable(fc->fs_type, current_user_ns()))
+ return -EPERM;
+ }
+
root = fc->fs_type->mount(fc->fs_type, fc->sb_flags,
fc->source, ctx->legacy_data);
if (IS_ERR(root))