CVE-2024-26726: btrfs: don't drop extent_map for free space inode on write error

Published Apr 3, 2024
·
Updated

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

btrfs: don't drop extentmap for free space inode on write error

While running the CI for an unrelated change I hit the following panic with generic/648 on btrfsholesspacecache.

assertion failed: blockstart != EXTENTMAPHOLE, in fs/btrfs/extentio.c:1385 ------------[ cut here ]------------ kernel BUG at fs/btrfs/extentio.c:1385! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 1 PID: 2695096 Comm: fsstress Kdump: loaded Tainted: G W 6.8.0-rc2+ #1 RIP: 0010:extentwritepageio.constprop.0+0x4c1/0x5c0 Call Trace: <TASK> extentwritecachepages+0x2ac/0x8f0 extentwritepages+0x87/0x110 dowritepages+0xd5/0x1f0 filemapfdatawritewbc+0x63/0x90 filemapfdatawriterange+0x5c/0x80 btrfsfdatawriterange+0x1f/0x50 btrfswriteoutcache+0x507/0x560 btrfswritedirtyblockgroups+0x32a/0x420 commitcowonlyroots+0x21b/0x290 btrfscommittransaction+0x813/0x1360 btrfssyncfile+0x51a/0x640 x64sysfdatasync+0x52/0x90 dosyscall64+0x9c/0x190 entrySYSCALL64afterhwframe+0x6e/0x76

This happens because we fail to write out the free space cache in one instance, come back around and attempt to write it again. However on the second pass through we go to call btrfsgetextent() on the inode to get the extent mapping. Because this is a new block group, and with the free space inode we always search the commit root to avoid deadlocking with the tree, we find nothing and return a EXTENTMAPHOLE for the requested range.

This happens because the first time we try to write the space cache out we hit an error, and on an error we drop the extent mapping. This is normal for normal files, but the free space cache inode is special. We always expect the extent map to be correct. Thus the second time through we end up with a bogus extent map.

Since we're deprecating this feature, the most straightforward way to fix this is to simply skip dropping the extent map range for this failed range.

I shortened the test by using error injection to stress the area to make it easier to reproduce. With this patch in place we no longer panic with my error injection test.

Affected Software

8 affected componentsFixes available
Linux Linux kernel<6.1.79
Linux Linux kernel>=6.2<6.6.18
Linux Linux kernel>=6.7<6.7.6
Linux Linux kernel=6.8-rc1
Linux Linux kernel=6.8-rc2
Linux Linux kernel=6.8-rc3
Linux Linux kernel=6.8-rc4
debian/linux<=5.10.223-1, <=5.10.234-1
6.1.129-16.1.133-16.12.22-16.12.25-1

Event History

Apr 3, 2024
CVE Published
via MITRE·02:55 PM
Data Sourced
via MITRE·02:55 PM
Description
Data Sourced
via NVD·03:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jul 12, 2024
Data Sourced
via Launchpad·12:46 PM
Description
Apr 27, 2025
Data Sourced
via Ubuntu·12:14 AM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-26726?

CVE-2024-26726 has not been assigned a severity rating as it is a recently resolved issue in the Linux kernel.

2

How do I fix CVE-2024-26726?

To fix CVE-2024-26726, upgrade to Linux kernel versions 6.1.123-1, 6.1.119-1, 6.12.10-1, or 6.12.11-1.

3

What versions of Linux are affected by CVE-2024-26726?

CVE-2024-26726 affects Linux kernel versions up to 5.10.226-1.

4

Does CVE-2024-26726 impact Btrfs file system users?

Yes, CVE-2024-26726 specifically affects users of the Btrfs file system in the Linux kernel.

5

What kind of issue does CVE-2024-26726 address?

CVE-2024-26726 addresses an issue related to handling extent maps for free space in the Btrfs file system during write errors.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203