From: Eric Biggers <ebiggers@kernel.org>
To: linux-fscrypt@vger.kernel.org
Cc: Theodore Ts'o <tytso@mit.edu>, Jaegeuk Kim <jaegeuk@kernel.org>,
linux-fsdevel@vger.kernel.org, stable@vger.kernel.org,
Ada Smith <adasmithgt@gmail.com>
Subject: Re: [PATCH] fscrypt: Initialize ->ci_master_key before publication
Date: Wed, 11 Nov 2026 12:59:33 -0800 [thread overview]
Message-ID: <20261111205933.GA41158@quark> (raw)
In-Reply-To: <20261110212011.35487-1-ebiggers@kernel.org>
On Tue, Nov 10, 2026 at 01:20:11PM -0800, Eric Biggers wrote:
> fscrypt_prepare_setflags() assumes that if the key for an inode with a
> v2 encryption policy has been set up, then ->ci_master_key is non-NULL.
> This is a reasonable assumption, but it does not take into account the
> very short gap in fscrypt_setup_encryption_info() between the inode's
> fscrypt_inode_info being set and ->ci_master_key being initialized.
> Thus, a NULL pointer dereference was possible.
>
> Fix this by closing the gap: make fscrypt_setup_encryption_info()
> initialize ->ci_master_key before publication. If it loses the cmpxchg
> race afterwards, set it back to NULL so that put_crypt_info() continues
> to have the same behavior.
>
> Fixes: b1c0ec3599f4 ("fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY ioctl")
> Cc: stable@vger.kernel.org
> Reported-by: Ada Smith <adasmithgt@gmail.com>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
>
> This patch applies to v7.4-rc2, and I'm planning to take it via the
> fscrypt tree.
Applied to https://git.kernel.org/pub/scm/fs/fscrypt/linux.git/log/?h=for-current
Reviews appreciated!
- Eric
prev parent reply other threads:[~2026-11-11 20:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 21:20 [PATCH] fscrypt: Initialize ->ci_master_key before publication Eric Biggers
2026-11-11 20:59 ` Eric Biggers [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=20261111205933.GA41158@quark \
--to=ebiggers@kernel.org \
--cc=adasmithgt@gmail.com \
--cc=jaegeuk@kernel.org \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-fsdevel@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