summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/namei.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2019-06-18 20:12:47 +0200
committerMark Brown <broonie@kernel.org>2019-06-18 20:12:47 +0200
commite1d700f7c94e755106749411706a38e39a93404b (patch)
treeb1230cb7eba5a4ef28ed2cd2527d9ac78f06cc00 /fs/overlayfs/namei.c
parentregulator: qcom_spmi: Refactor get_mode/set_mode (diff)
parentLinux 5.2-rc4 (diff)
downloadlinux-e1d700f7c94e755106749411706a38e39a93404b.tar.xz
linux-e1d700f7c94e755106749411706a38e39a93404b.zip
Merge tag 'v5.2-rc4' into regulator-5.3
Linux 5.2-rc4
Diffstat (limited to 'fs/overlayfs/namei.c')
-rw-r--r--fs/overlayfs/namei.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index efd372312ef1..badf039267a2 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -18,6 +18,7 @@
#include "overlayfs.h"
struct ovl_lookup_data {
+ struct super_block *sb;
struct qstr name;
bool is_dir;
bool opaque;
@@ -244,6 +245,12 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
if (!d->metacopy || d->last)
goto out;
} else {
+ if (ovl_lookup_trap_inode(d->sb, this)) {
+ /* Caught in a trap of overlapping layers */
+ err = -ELOOP;
+ goto out_err;
+ }
+
if (last_element)
d->is_dir = true;
if (d->last)
@@ -819,6 +826,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
int err;
bool metacopy = false;
struct ovl_lookup_data d = {
+ .sb = dentry->d_sb,
.name = dentry->d_name,
.is_dir = false,
.opaque = false,