summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/super.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2017-06-21 14:28:37 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2017-07-04 22:03:17 +0200
commit8b88a2e6403638b56556ed5b1c60d9318eefea9c (patch)
treec15c850ac2640fb933e393bfb38fdc30d2f73bd2 /fs/overlayfs/super.c
parentovl: introduce the inodes index dir feature (diff)
downloadlinux-8b88a2e6403638b56556ed5b1c60d9318eefea9c.tar.xz
linux-8b88a2e6403638b56556ed5b1c60d9318eefea9c.zip
ovl: verify upper root dir matches lower root dir
When inodes index feature is enabled, verify that the file handle stored in upper root dir matches the lower root dir or fail to mount. If upper root dir has no stored file handle, encode and store the lower root dir file handle in overlay.origin xattr. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to '')
-rw-r--r--fs/overlayfs/super.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index fa83b3245124..bfdcff0f3168 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1048,6 +1048,14 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
ufs->same_sb = NULL;
if (!(ovl_force_readonly(ufs)) && ufs->config.index) {
+ /* Verify lower root is upper root origin */
+ err = ovl_verify_origin(upperpath.dentry, ufs->lower_mnt[0],
+ stack[0].dentry, true);
+ if (err) {
+ pr_err("overlayfs: failed to verify upper root origin\n");
+ goto out_put_lower_mnt;
+ }
+
ufs->indexdir = ovl_workdir_create(sb, ufs, workpath.dentry,
OVL_INDEXDIR_NAME, true);
err = PTR_ERR(ufs->indexdir);