summaryrefslogtreecommitdiff
path: root/fs/overlayfs/super.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2018-05-11 18:49:31 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2018-07-20 10:56:12 +0300
commit2c3d73589adc6d3450890a6f793e5e8a1ae894e0 (patch)
treeec83c4ebcdd9f6a0885ad9a28add2cdb78ac9321 /fs/overlayfs/super.c
parent8c444d2a971fdccda670e874f12443627f028fbc (diff)
downloadlinux-2c3d73589adc6d3450890a6f793e5e8a1ae894e0.tar.xz
ovl: Do not expose metacopy only dentry from d_real()
Metacopy dentry/inode is internal to overlay and is never exposed outside of it. Exception is metacopy upper file used for fsync(). Modify d_real() to look for dentries/inode which have data, but also allow matching upper inode without data for the fsync case. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/super.c')
-rw-r--r--fs/overlayfs/super.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 6d22bbd5f27f..2e0fc93c2c06 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -95,10 +95,13 @@ static struct dentry *ovl_d_real(struct dentry *dentry,
}
real = ovl_dentry_upper(dentry);
- if (real && (!inode || inode == d_inode(real)))
+ if (real && (inode == d_inode(real)))
return real;
- real = ovl_dentry_lower(dentry);
+ if (real && !inode && ovl_has_upperdata(d_inode(dentry)))
+ return real;
+
+ real = ovl_dentry_lowerdata(dentry);
if (!real)
goto bug;