diff options
| author | Eric Biggers <ebiggers@kernel.org> | 2026-11-10 13:20:11 -0800 |
|---|---|---|
| committer | Eric Biggers <ebiggers@kernel.org> | 2026-11-10 14:19:21 -0800 |
| commit | 2de253924266eeedb798fb662173726c90b0cf04 (patch) | |
| tree | 5a9c7a35f74c8095766cc363a67e34c2f963ea78 /kernel/debug/debug_core.c | |
| parent | 7475ea8b58616b33c04afb976cf0fbaad9dd63fb (diff) | |
fscrypt: Initialize ->ci_master_key before publication
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>
Link: https://patch.msgid.link/20261110212011.35487-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'kernel/debug/debug_core.c')
0 files changed, 0 insertions, 0 deletions
