On Tue, Dec 06, 2022 at 04:01:48PM -0500, Theodore Ts'o wrote:
On Tue, 1 Nov 2022 22:33:12 -0700, Eric Biggers wrote:
From: Eric Biggers ebiggers@google.com
Mounting a filesystem whose journal inode has the encrypt flag causes a NULL dereference in fscrypt_limit_io_blocks() when the 'inlinecrypt' mount option is used.
The problem is that when jbd2_journal_init_inode() calls bmap(), it eventually finds its way into ext4_iomap_begin(), which calls fscrypt_limit_io_blocks(). fscrypt_limit_io_blocks() requires that if the inode is encrypted, then its encryption key must already be set up. That's not the case here, since the journal inode is never "opened" like a normal file would be. Hence the crash.
[...]
Applied, thanks!
[1/1] ext4: don't allow journal inode to have encrypt flag commit: 29cef51d8522c4d8953856afaffcaf1b754e4f6c
Best regards,
Theodore Ts'o tytso@mit.edu
Thanks Ted. Note that I also sent an e2fsprogs patch to make e2fsck fix this situation: https://lore.kernel.org/r/20221102220551.3940-1-ebiggers@kernel.org
- Eric