CVE-2022-50277

Source
https://nvd.nist.gov/vuln/detail/CVE-2022-50277
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-50277.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-50277
Downstream
Related
Published
2025-09-15T14:21:14Z
Modified
2025-10-16T08:08:49.133002Z
Summary
ext4: don't allow journal inode to have encrypt flag
Details

In the Linux kernel, the following vulnerability has been resolved:

ext4: don't allow journal inode to have encrypt flag

Mounting a filesystem whose journal inode has the encrypt flag causes a NULL dereference in fscryptlimitio_blocks() when the 'inlinecrypt' mount option is used.

The problem is that when jbd2journalinitinode() calls bmap(), it eventually finds its way into ext4iomapbegin(), which calls fscryptlimitioblocks(). fscryptlimitio_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.

A reproducer is:

mkfs.ext4 -F /dev/vdb
debugfs -w /dev/vdb -R "set_inode_field <8> flags 0x80808"
mount /dev/vdb /mnt -o inlinecrypt

To fix this, make ext4 consider journal inodes with the encrypt flag to be invalid. (Note, maybe other flags should be rejected on the journal inode too. For now, this is just the minimal fix for the above issue.)

I've marked this as fixing the commit that introduced the call to fscryptlimitio_blocks(), since that's what made an actual crash start being possible. But this fix could be applied to any version of ext4 that supports the encrypt feature.

References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
38ea50daa7a447dbcd7031f37a39a1baa163b2ab
Fixed
1f7a6626f611aa06d7907aa45b484708dd5ac8bc
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
38ea50daa7a447dbcd7031f37a39a1baa163b2ab
Fixed
bcc5057e1781a3ee889225480d995c3b5cbde555
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
38ea50daa7a447dbcd7031f37a39a1baa163b2ab
Fixed
105c78e12468413e426625831faa7db4284e1fec

Affected versions

v5.*

v5.17
v5.17-rc4
v5.17-rc5
v5.17-rc6
v5.17-rc7
v5.17-rc8
v5.18
v5.18-rc1
v5.18-rc2
v5.18-rc3
v5.18-rc4
v5.18-rc5
v5.18-rc6
v5.18-rc7
v5.19
v5.19-rc1
v5.19-rc2
v5.19-rc3
v5.19-rc4
v5.19-rc5
v5.19-rc6
v5.19-rc7
v5.19-rc8

v6.*

v6.0
v6.0-rc1
v6.0-rc2
v6.0-rc3
v6.0-rc4
v6.0-rc5
v6.0-rc6
v6.0-rc7
v6.0.1
v6.0.10
v6.0.11
v6.0.12
v6.0.13
v6.0.14
v6.0.15
v6.0.16
v6.0.17
v6.0.2
v6.0.3
v6.0.4
v6.0.5
v6.0.6
v6.0.7
v6.0.8
v6.0.9
v6.1
v6.1-rc1
v6.1-rc2
v6.1-rc3
v6.1-rc4
v6.1-rc5
v6.1-rc6
v6.1-rc7
v6.1-rc8
v6.1.1
v6.1.2
v6.1.3

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
5.18.0
Fixed
6.0.18
Type
ECOSYSTEM
Events
Introduced
6.1.0
Fixed
6.1.4