@@ -1834,6 +1834,19 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
return NULL;
}
+ /* Create a case-insensitive cache entry with the real
+ * name stored, in case our search pattern differs
+ * in terms of case.
+ */
+ if (inode && IS_CASEFOLDED(dir) &&
+ memcmp(de->name, dentry->d_name.name, de->name_len)) {
+ struct qstr dname;
+
+ dname.len = de->name_len;
+ dname.name = de->name;
+ return d_add_ci(dentry, inode, &dname);
+ }
+
return d_splice_alias(inode, dentry);
}
In lookup function, if we have a file match but not a case match in the case-insensitive case, call d_add_ci to store the real filename into cache instead of the case variant of the name that was looked up. This avoids exposing into user space (e.g. /proc/self/cwd) internal cache data. Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com> --- fs/ext4/namei.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)