All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Gabriel Krisman Bertazi <krisman@suse.de>
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 22:38:57 +0000	[thread overview]
Message-ID: <20240117223857.GN1674809@ZenIV> (raw)
In-Reply-To: <20240117222836.11086-1-krisman@suse.de>

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?

  reply	other threads:[~2024-01-17 22:39 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 [this message]
2024-01-18  0:02   ` Gabriel Krisman Bertazi
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=20240117223857.GN1674809@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=ebiggers@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=krisman@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    /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.