From: Gabriel Krisman Bertazi <krisman@suse.de>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: ebiggers@kernel.org, tytso@mit.edu,
linux-fsdevel@vger.kernel.org, jaegeuk@kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] libfs: Attempt exact-match comparison first during casefold lookup
Date: Wed, 17 Jan 2024 21:02:03 -0300 [thread overview]
Message-ID: <87edeffr0k.fsf@mailhost.krisman.be> (raw)
In-Reply-To: <20240117223857.GN1674809@ZenIV> (Al Viro's message of "Wed, 17 Jan 2024 22:38:57 +0000")
Al Viro <viro@zeniv.linux.org.uk> writes:
> On Wed, Jan 17, 2024 at 07:28:36PM -0300, Gabriel Krisman Bertazi wrote:
>
>> Note that, for strict mode, generic_ci_d_compare used to reject an
>> invalid UTF-8 string, which would now be considered valid if it
>> exact-matches the disk-name. But, if that is the case, the filesystem
>> is corrupt. More than that, it really doesn't matter in practice,
>> because the name-under-lookup will have already been rejected by
>> generic_ci_d_hash and we won't even get here.
>
>> - if (ret >= 0)
>> - return ret;
>> -
>> - if (sb_has_strict_encoding(sb))
>> + qstr.len = len;
>> + qstr.name = str;
>> + ret = utf8_strncasecmp(dentry->d_sb->s_encoding, name, &qstr);
>> + if (ret < 0)
>> return -EINVAL;
>
> Umm... So why bother with -EINVAL? The rest looks sane, but
> considering the fact that your string *has* passed ->d_hash(),
> do we need anything beyond
> return utf8_strncasecmp(dentry->d_sb->s_encoding, name, &qstr);
> here?
No, you are right. In fact, it seems d_compare can't propagate errors
anyway as it is only compared against 0, anyway.
I spin the v2 dropping this bit as suggested.
thanks,
--
Gabriel Krisman Bertazi
next prev parent reply other threads:[~2024-01-18 0:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 22:28 [PATCH] libfs: Attempt exact-match comparison first during casefold lookup Gabriel Krisman Bertazi
2024-01-17 22:38 ` Al Viro
2024-01-18 0:02 ` Gabriel Krisman Bertazi [this message]
2024-01-18 0:40 ` Linus Torvalds
2024-01-18 2:05 ` Theodore Ts'o
2024-01-18 2:33 ` Linus Torvalds
2024-01-18 15:06 ` Gabriel Krisman Bertazi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87edeffr0k.fsf@mailhost.krisman.be \
--to=krisman@suse.de \
--cc=ebiggers@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.