CVE-2025-40233: ocfs2: clear extent cache after moving/defragmenting extents
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: clear extent cache after moving/defragmenting extents
The extent map cache can become stale when extents are moved or defragmented, causing subsequent operations to see outdated extent flags. This triggers a BUGON in ocfs2refcountcalcowclusters().
The problem occurs when: 1. copyfilerange() creates a reflinked extent with OCFS2EXTREFCOUNTED 2. ioctl(FITRIM) triggers ocfs2moveextents() 3. ocfs2moveextentsrange() reads and caches the extent (flags=0x2) 4. ocfs2moveextent()/ocfs2defragextent() calls ocfs2moveextent() which clears OCFS2EXTREFCOUNTED flag on disk (flags=0x0) 5. The extent map cache is not invalidated after the move 6. Later write() operations read stale cached flags (0x2) but disk has updated flags (0x0), causing a mismatch 7. BUGON(!(rec->eflags & OCFS2EXTREFCOUNTED)) triggers
Fix by clearing the extent map cache after each extent move/defrag operation in ocfs2moveextentsrange(). This ensures subsequent operations read fresh extent data from disk.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Apply the ocfs2 fix to clear/invalidate the extent map cache after each extent move or defrag operation (e.g., after __ocfs2_move_extents_range() / ocfs2_move_extent() / ocfs2_defrag_extent()). This prevents later write()/FITRIM operations from reading stale cached extent flags.
Linux kernel (ocfs2) Clear extent map cache after moving/defragmenting extents = enabled
Event History
Frequently Asked Questions
What is the severity of CVE-2025-40233?
CVE-2025-40233 has a severity rating that may vary based on the specific Linux kernel version affected.
How do I fix CVE-2025-40233?
To fix CVE-2025-40233, update your Linux kernel to the latest version where the vulnerability has been patched.
Which versions of the Linux kernel are affected by CVE-2025-40233?
CVE-2025-40233 affects certain versions of the Linux kernel, particularly those that do not have the latest fixes applied.
What are the potential impacts of CVE-2025-40233?
The potential impacts of CVE-2025-40233 include stale extent cache leading to outdated extent flags, which may affect system stability and data integrity.
Is CVE-2025-40233 a public vulnerability?
Yes, CVE-2025-40233 is a public vulnerability that has been documented for awareness and remediation efforts.