[RFC PATCH 4/4] ovl: fix redirect feature for backward compatibility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For a redirect dir was created before the overlayfs support
"feature set", upper root dir does not contain the redirect dir
feature xattr. In that case, we cannot detect this feature during
mount time, so fix this feature set once a redirect xattr is detected
in ovl_lookup().

Signed-off-by: zhangyi (F) <yi.zhang@xxxxxxxxxx>
---
 fs/overlayfs/namei.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 70fcfcc684cc..9325c5a870c0 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -914,6 +914,18 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
 		ctr++;
 
 		/*
+		 * Detect redirect xattr but not enable this feature, this
+		 * redirect maybe set by the old overlay driver, fix this
+		 * feature for backward compatibility.
+		 */
+		if (d.redirect && !ofs->config.redirect_dir &&
+		    !ovl_has_feature_redirect_dir(dentry->d_sb)) {
+			err = ovl_set_feature_redirect_dir(dentry->d_sb);
+			if (err)
+				goto out_put;
+		}
+
+		/*
 		 * Following redirects can have security consequences: it's like
 		 * a symlink into the lower layer without the permission checks.
 		 * This is only a problem if the upper layer is untrusted (e.g
-- 
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux