ovl: Check for casefold consistency when creating new dentries

In a overlayfs with casefold enabled, all new dentries should have
casefold enabled as well. Check this at ovl_create_real().

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: André Almeida <andrealmeid@igalia.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
This commit is contained in:
André Almeida 2025-08-14 14:22:19 -03:00 committed by Amir Goldstein
parent f9377faaea
commit dfc7da402c

View File

@ -187,6 +187,13 @@ struct dentry *ovl_create_real(struct ovl_fs *ofs, struct dentry *parent,
/* mkdir is special... */
newdentry = ovl_do_mkdir(ofs, dir, newdentry, attr->mode);
err = PTR_ERR_OR_ZERO(newdentry);
/* expect to inherit casefolding from workdir/upperdir */
if (!err && ofs->casefold != ovl_dentry_casefolded(newdentry)) {
pr_warn_ratelimited("wrong inherited casefold (%pd2)\n",
newdentry);
dput(newdentry);
err = -EINVAL;
}
break;
case S_IFCHR: