summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2021-01-28 10:22:48 +0100
committerMiklos Szeredi <mszeredi@redhat.com>2021-01-28 10:22:48 +0100
commit9efb069de4ba748d284f6129e71de239f801053a (patch)
tree1fb80e242f68bc99732e6cbf09964faa8b74451a /fs/overlayfs
parent19c329f6808995b142b3966301f217c831e7cf31 (diff)
downloadlinux-9efb069de4ba748d284f6129e71de239f801053a.tar.bz2
ovl: add warning on user_ns mismatch
Currently there's no way to create an overlay filesystem outside of the current user namespace. Make sure that if this assumption changes it doesn't go unnoticed. Reported-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r--fs/overlayfs/super.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 2bd570cbe8a4..82cd6d55a5a1 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1923,6 +1923,10 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
unsigned int numlower;
int err;
+ err = -EIO;
+ if (WARN_ON(sb->s_user_ns != current_user_ns()))
+ goto out;
+
sb->s_d_op = &ovl_dentry_operations;
err = -ENOMEM;