Skip to main content

CVE-2022-49414: Vulnerability in Linux Linux

High
VulnerabilityCVE-2022-49414cvecve-2022-49414
Published: Wed Feb 26 2025 (02/26/2025, 02:12:35 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: ext4: fix race condition between ext4_write and ext4_convert_inline_data Hulk Robot reported a BUG_ON: ================================================================== EXT4-fs error (device loop3): ext4_mb_generate_buddy:805: group 0, block bitmap and bg descriptor inconsistent: 25 vs 31513 free clusters kernel BUG at fs/ext4/ext4_jbd2.c:53! invalid opcode: 0000 [#1] SMP KASAN PTI CPU: 0 PID: 25371 Comm: syz-executor.3 Not tainted 5.10.0+ #1 RIP: 0010:ext4_put_nojournal fs/ext4/ext4_jbd2.c:53 [inline] RIP: 0010:__ext4_journal_stop+0x10e/0x110 fs/ext4/ext4_jbd2.c:116 [...] Call Trace: ext4_write_inline_data_end+0x59a/0x730 fs/ext4/inline.c:795 generic_perform_write+0x279/0x3c0 mm/filemap.c:3344 ext4_buffered_write_iter+0x2e3/0x3d0 fs/ext4/file.c:270 ext4_file_write_iter+0x30a/0x11c0 fs/ext4/file.c:520 do_iter_readv_writev+0x339/0x3c0 fs/read_write.c:732 do_iter_write+0x107/0x430 fs/read_write.c:861 vfs_writev fs/read_write.c:934 [inline] do_pwritev+0x1e5/0x380 fs/read_write.c:1031 [...] ================================================================== Above issue may happen as follows: cpu1 cpu2 __________________________|__________________________ do_pwritev vfs_writev do_iter_write ext4_file_write_iter ext4_buffered_write_iter generic_perform_write ext4_da_write_begin vfs_fallocate ext4_fallocate ext4_convert_inline_data ext4_convert_inline_data_nolock ext4_destroy_inline_data_nolock clear EXT4_STATE_MAY_INLINE_DATA ext4_map_blocks ext4_ext_map_blocks ext4_mb_new_blocks ext4_mb_regular_allocator ext4_mb_good_group_nolock ext4_mb_init_group ext4_mb_init_cache ext4_mb_generate_buddy --> error ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA) ext4_restore_inline_data set EXT4_STATE_MAY_INLINE_DATA ext4_block_write_begin ext4_da_write_end ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA) ext4_write_inline_data_end handle=NULL ext4_journal_stop(handle) __ext4_journal_stop ext4_put_nojournal(handle) ref_cnt = (unsigned long)handle BUG_ON(ref_cnt == 0) ---> BUG_ON The lock held by ext4_convert_inline_data is xattr_sem, but the lock held by generic_perform_write is i_rwsem. Therefore, the two locks can be concurrent. To solve above issue, we add inode_lock() for ext4_convert_inline_data(). At the same time, move ext4_convert_inline_data() in front of ext4_punch_hole(), remove similar handling from ext4_punch_hole().

AI-Powered Analysis

AILast updated: 06/30/2025, 06:57:17 UTC

Technical Analysis

CVE-2022-49414 is a vulnerability in the Linux kernel's ext4 filesystem implementation, specifically involving a race condition between ext4_write and ext4_convert_inline_data functions. The ext4 filesystem supports inline data storage to optimize small file writes, but this vulnerability arises due to improper synchronization between two locks: xattr_sem held by ext4_convert_inline_data and i_rwsem held by generic_perform_write. This concurrency issue can lead to inconsistent block bitmap and block group descriptor states, causing kernel BUG_ON errors and potentially leading to system crashes or data corruption. The bug manifests as an ext4 filesystem error indicating inconsistency between free cluster counts, followed by a kernel panic triggered by a BUG_ON macro when a reference count unexpectedly reaches zero. The root cause is that ext4_convert_inline_data lacked proper inode locking, allowing concurrent modifications that corrupt filesystem metadata. The fix involves adding inode_lock() to ext4_convert_inline_data to serialize access and reordering ext4_convert_inline_data before ext4_punch_hole to prevent similar race conditions. This vulnerability affects Linux kernel versions using the ext4 filesystem with inline data support and can be triggered by concurrent write and fallocate operations. Although no known exploits are reported in the wild, the issue can cause denial of service through kernel crashes and potential data integrity loss.

Potential Impact

For European organizations relying on Linux servers with ext4 filesystems, this vulnerability poses a risk of unexpected system crashes and filesystem corruption, potentially leading to denial of service and data loss. Critical infrastructure, cloud service providers, and enterprises running Linux-based storage or application servers could experience operational disruptions. The impact is particularly significant for environments with high concurrency and intensive file operations, such as databases, file servers, and container hosts. Data integrity issues may also complicate recovery and forensic analysis. Since ext4 is a widely used default filesystem in many Linux distributions popular in Europe, the vulnerability could affect a broad range of systems. The lack of known exploits reduces immediate risk, but the potential for kernel panics and data corruption necessitates prompt attention to avoid service interruptions and maintain compliance with data protection regulations.

Mitigation Recommendations

European organizations should prioritize updating Linux kernels to versions that include the patch fixing CVE-2022-49414. Kernel updates should be tested in staging environments to ensure compatibility. In the interim, administrators can reduce risk by limiting concurrent write and fallocate operations on ext4 filesystems, especially those involving inline data. Monitoring kernel logs for ext4-related errors can provide early warning signs. Employing filesystem integrity checks and regular backups will help mitigate data loss risks. For critical systems, consider isolating workloads or migrating sensitive data to filesystems not affected by this issue until patches are applied. Additionally, organizations should review and harden system configurations to minimize attack surface and ensure that only trusted users have write access to vulnerable filesystems. Coordinating with Linux distribution vendors for timely patch deployment is essential.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2025-02-26T02:08:31.568Z
Cisa Enriched
false
Cvss Version
null
State
PUBLISHED

Threat ID: 682d982dc4522896dcbe594f

Added to database: 5/21/2025, 9:09:01 AM

Last enriched: 6/30/2025, 6:57:17 AM

Last updated: 8/14/2025, 1:13:22 PM

Views: 17

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats