CVE-2022-50638

Source
https://cve.org/CVERecord?id=CVE-2022-50638
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-50638.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-50638
Downstream
Related
Published
2025-12-09T00:00:11.665Z
Modified
2026-03-20T12:22:36.693169Z
Summary
ext4: fix bug_on in __es_tree_search caused by bad boot loader inode
Details

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

ext4: fix bug_on in __estreesearch caused by bad boot loader inode

We got a issue as fllows:

kernel BUG at fs/ext4/extentsstatus.c:203! invalid opcode: 0000 [#1] PREEMPT SMP CPU: 1 PID: 945 Comm: cat Not tainted 6.0.0-next-20221007-dirty #349 RIP: 0010:ext4es_end.isra.0+0x34/0x42 RSP: 0018:ffffc9000143b768 EFLAGS: 00010203 RAX: 0000000000000000 RBX: ffff8881769cd0b8 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff8fc27cf7 RDI: 00000000ffffffff RBP: ffff8881769cd0bc R08: 0000000000000000 R09: ffffc9000143b5f8 R10: 0000000000000001 R11: 0000000000000001 R12: ffff8881769cd0a0 R13: ffff8881768e5668 R14: 00000000768e52f0 R15: 0000000000000000 FS: 00007f359f7f05c0(0000)GS:ffff88842fd00000(0000)knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f359f5a2000 CR3: 000000017130c000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> __estreesearch.isra.0+0x6d/0xf5 ext4escacheextent+0xfa/0x230 ext4cacheextents+0xd2/0x110 ext4findextent+0x5d5/0x8c0 ext4extmapblocks+0x9c/0x1d30 ext4mapblocks+0x431/0xa50 ext4mpagereadpages+0x48e/0xe40 ext4readahead+0x47/0x50 readpages+0x82/0x530 pagecacheraunbounded+0x199/0x2a0 dopagecachera+0x47/0x70 pagecacheraorder+0x242/0x400 ondemandreadahead+0x1e8/0x4b0 pagecachesyncra+0xf4/0x110 filemapgetpages+0x131/0xb20 filemapread+0xda/0x4b0 genericfilereaditer+0x13a/0x250 ext4filereaditer+0x59/0x1d0 vfsread+0x28f/0x460 ksysread+0x73/0x160 __x64sysread+0x1e/0x30 dosyscall64+0x35/0x80 entrySYSCALL64afterhwframe+0x63/0xcd

</TASK>

In the above issue, ioctl invokes the swapinodebootloader function to swap inode<5> and inode<12>. However, inode<5> contain incorrect imode and disordered extents, and inlink is set to 1. The extents check for inode in the ext4iget function can be bypassed bacause 5 is EXT4BOOTLOADERINO. While linkscount is set to 1, the extents are not initialized in swapinodebootloader. After the ioctl command is executed successfully, the extents are swapped to inode<12>, in this case, run the cat command to view inode<12>. And Bug_ON is triggered due to the incorrect extents.

When the boot loader inode is not initialized, its imode can be one of the following: 1) the imode is a bad type, which is marked as badinode in ext4iget and set to SIFREG. 2) the imode is good type but not SIFREG. 3) the imode is S_IFREG.

The BUGON may be triggered by bypassing the check in cases 1 and 2. Therefore, when the boot loader inode is badinode or its imode is not S_IFREG, initialize the inode to avoid triggering the BUG.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50638.json",
    "cna_assigner": "Linux"
}
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
393d1d1d76933886d5e1ce603214c9987589c6d5
Fixed
e76ede9d2c9e0af4573342b56d7cdbf757c18084
Fixed
a95ba369255ddcdc5e43d38bc5203537bdf3a518
Fixed
5f8d36abd2059bf1bd016b17d1fe78d8613deddd
Fixed
78e335fb573e6a85718c4c24d5a052718a99a9ed
Fixed
71e99ec1315fe98d322b17b9a28f204aaf15ffee
Fixed
d480a49c15c465cb9a16db1379f4996e9b5bb9cc
Fixed
feec0ea94c5ef4aa118750284c8a921698733ef2
Fixed
a125c8806b7d3c3815b6f9f59d395b9d7527b0ef
Fixed
991ed014de0840c5dc405b679168924afb2952ac

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-50638.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.10.0
Fixed
4.9.337
Type
ECOSYSTEM
Events
Introduced
4.10.0
Fixed
4.14.303
Type
ECOSYSTEM
Events
Introduced
4.15.0
Fixed
4.19.270
Type
ECOSYSTEM
Events
Introduced
4.20.0
Fixed
5.4.229
Type
ECOSYSTEM
Events
Introduced
5.5.0
Fixed
5.10.163
Type
ECOSYSTEM
Events
Introduced
5.11.0
Fixed
5.15.87
Type
ECOSYSTEM
Events
Introduced
5.16.0
Fixed
6.0.18
Type
ECOSYSTEM
Events
Introduced
6.1.0
Fixed
6.1.4

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-50638.json"