Skip to contentSkip to conversation

CVE-2022-50485: ext4: add EXT4_IGET_BAD flag to prevent unexpected bad inode

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Oct 4, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

ext4: add EXT4_IGET_BAD flag to prevent unexpected bad inode

There are many places that will get unhappy (and crash) when ext4_iget() returns a bad inode. However, if iget the boot loader inode, allows a bad inode to be returned, because the inode may not be initialized. This mechanism can be used to bypass some checks and cause panic. To solve this problem, we add a special iget flag EXT4_IGET_BAD. Only with this flag we'd be returning bad inode from ext4_iget(), otherwise we always return the error code if the inode is bad inode.(suggested by Jan Kara)

The Linux kernel CVE team has assigned CVE-2022-50485 to this issue.

Affected and fixed versions
===========================

	Fixed in 5.4.229 with commit 2142dfa1de61e25b83198af0308ec7689cca25d3
	Fixed in 5.10.163 with commit c0a738875c2e9c8c3366d792f8bf7fe508d5e5a5
	Fixed in 5.15.87 with commit f7e6b5548f915d7aa435d0764d41eacfb49c6e09
	Fixed in 6.0.18 with commit f725b290ed79ad61e4f721fee95a287892d8b1ad
	Fixed in 6.1.4 with commit 488a5c2bf7543c3cd3f07a025f2e62be91599430
	Fixed in 6.2 with commit 63b1e9bccb71fe7d7e3ddc9877dbdc85e5d2d023

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2022-50485

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:

	fs/ext4/ext4.h
	fs/ext4/inode.c
	fs/ext4/ioctl.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/2142dfa1de61e25b83198af0308ec7689cca25d3
	https://git.kernel.org/stable/c/c0a738875c2e9c8c3366d792f8bf7fe508d5e5a5
	https://git.kernel.org/stable/c/f7e6b5548f915d7aa435d0764d41eacfb49c6e09
	https://git.kernel.org/stable/c/f725b290ed79ad61e4f721fee95a287892d8b1ad
	https://git.kernel.org/stable/c/488a5c2bf7543c3cd3f07a025f2e62be91599430
	https://git.kernel.org/stable/c/63b1e9bccb71fe7d7e3ddc9877dbdc85e5d2d023