From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Gabriel Krisman Bertazi <krisman@collabora.com>
Cc: Eric Biggers <ebiggers@kernel.org>,
linux-fscrypt@vger.kernel.org, stable@vger.kernel.org,
Daniel Rosenberg <drosen@google.com>,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: don't use casefolded comparison for "." and ".."
Date: Mon, 16 May 2022 10:22:26 -0700 [thread overview]
Message-ID: <YoKIUgM4ckAC1n/O@google.com> (raw)
In-Reply-To: <87r14txyrx.fsf@collabora.com>
Thanks, applied.
On 05/16, Gabriel Krisman Bertazi wrote:
> Eric Biggers <ebiggers@kernel.org> writes:
>
> > From: Eric Biggers <ebiggers@google.com>
> >
> > Tryng to rename a directory that has all following properties fails with
> > EINVAL and triggers the 'WARN_ON_ONCE(!fscrypt_has_encryption_key(dir))'
> > in f2fs_match_ci_name():
> >
> > - The directory is casefolded
> > - The directory is encrypted
> > - The directory's encryption key is not yet set up
> > - The parent directory is *not* encrypted
> >
> > The problem is incorrect handling of the lookup of ".." to get the
> > parent reference to update. fscrypt_setup_filename() treats ".." (and
> > ".") specially, as it's never encrypted. It's passed through as-is, and
> > setting up the directory's key is not attempted. As the name isn't a
> > no-key name, f2fs treats it as a "normal" name and attempts a casefolded
> > comparison. That breaks the assumption of the WARN_ON_ONCE() in
> > f2fs_match_ci_name() which assumes that for encrypted directories,
> > casefolded comparisons only happen when the directory's key is set up.
> >
> > We could just remove this WARN_ON_ONCE(). However, since casefolding is
> > always a no-op on "." and ".." anyway, let's instead just not casefold
> > these names. This results in the standard bytewise comparison.
> >
> > Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
> > Cc: <stable@vger.kernel.org> # v5.11+
> > Signed-off-by: Eric Biggers <ebiggers@google.com>
> > ---
> > fs/f2fs/dir.c | 3 ++-
> > fs/f2fs/f2fs.h | 10 +++++-----
> > fs/f2fs/hash.c | 11 ++++++-----
> > 3 files changed, 13 insertions(+), 11 deletions(-)
>
> Hi Eric,
>
> This looks good to me:
>
> Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
>
> Thanks,
>
> --
> Gabriel Krisman Bertazi
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
prev parent reply other threads:[~2022-05-16 17:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-14 17:59 [PATCH] f2fs: don't use casefolded comparison for "." and ".." Eric Biggers
2022-05-16 15:50 ` Gabriel Krisman Bertazi
2022-05-16 17:22 ` Jaegeuk Kim [this message]
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=YoKIUgM4ckAC1n/O@google.com \
--to=jaegeuk@kernel.org \
--cc=drosen@google.com \
--cc=ebiggers@kernel.org \
--cc=krisman@collabora.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fscrypt@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox