From: Eric Biggers <ebiggers@kernel.org>
To: Baokun Li <libaokun@linux.alibaba.com>
Cc: linux-fscrypt@vger.kernel.org, tytso@mit.edu, jaegeuk@kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v3] fscrypt: Fix missing barrier in fscrypt_find_mode_key()
Date: Fri, 23 Oct 2026 19:38:21 +0000 [thread overview]
Message-ID: <20261023193821.GA3091192@google.com> (raw)
In-Reply-To: <20261023160747.1382973-1-libaokun@linux.alibaba.com>
On Sat, Oct 24, 2026 at 12:07:47AM +0800, Baokun Li wrote:
> dm-inlinecrypt reaches its key only through srcu_dereference(md->map),
> with no acquire anywhere on the I/O path.
The above seems like a stray sentence that should be deleted.
> Suggested-by: Eric Biggers <ebiggers@kernel.org>
> Link: https://patch.msgid.link/20261014161153.GC322435@quark
Nit: lore.kernel.org instead of patch.msgid.link, since it links to a
discussion (in response to a patch) rather than directly to a patch.
> diff --git a/fs/crypto/keysetup.c b/fs/crypto/keysetup.c
> index 892044ebcaca..984ef43982a3 100644
> --- a/fs/crypto/keysetup.c
> +++ b/fs/crypto/keysetup.c
> @@ -205,8 +205,14 @@ fscrypt_find_mode_key(struct fscrypt_master_key *mk, u8 hkdf_context,
> if (node->hkdf_context == hkdf_context &&
> node->mode_num == mode_num &&
> node->data_unit_bits == ci->ci_data_unit_bits &&
> - fscrypt_is_key_prepared(&node->key, ci))
> + fscrypt_is_key_prepared(&node->key, ci)) {
> + /*
> + * Pairs with list_add_tail_rcu() in
> + * setup_per_mode_enc_key().
> + */
> + smp_acquire__after_ctrl_dep();
> return &node->key;
> + }
> }
I think a better comment would be:
/*
* Upgrade the RCU dereference to a full ACQUIRE, so
* that blk-crypto global state is seen as initialized.
*/
That helps convey why the pre-existing RCU dereference isn't enough.
Other than that this patch looks good. I can fix all the above when
applying, if you agree, or you can just resend. Thanks!
- Eric
next prev parent reply other threads:[~2026-10-23 19:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 16:07 [PATCH v3] fscrypt: Fix missing barrier in fscrypt_find_mode_key() Baokun Li
2026-10-23 19:38 ` Eric Biggers [this message]
2026-10-24 9:53 ` Baokun Li
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=20261023193821.GA3091192@google.com \
--to=ebiggers@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=libaokun@linux.alibaba.com \
--cc=linux-fscrypt@vger.kernel.org \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox