Re: [PATCH v7 2/8] fs: Add standard casefolding support

Al Viro
2020-02-08T02:12:29Z

On Fri, Feb 07, 2020 at 05:35:46PM -0800, Daniel Rosenberg wrote:

> +int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
> + const char *str, const struct qstr *name)
> +{
> + const struct dentry *parent = READ_ONCE(dentry->d_parent);
> + const struct inode *inode = READ_ONCE(parent->d_inode);
> + const struct super_block *sb = dentry->d_sb;
> + const struct unicode_map *um = sb->s_encoding;
> + struct qstr entry = QSTR_INIT(str, len);
> + int ret;
> +
> + if (!inode || !needs_casefold(inode))
> + goto fallback;
> +
> + ret = utf8_strncasecmp(um, name, &entry);

Again, is that safe in case when the contents of the string str points to
keeps changing under you?