Skip to content
OpenAdvisories
Unscored CVE-2025-38503 EUVD-2025-25095GHSA-pm7p-wjq9-6m43

btrfs: fix assertion when building free space tree

Published Aug 16, 2025 · Updated May 23, 2026 · Assigned by Linux

Vendor: Linux Product: Linux Package: kernel Package: linux Package: linux Package: linux-allwinner-5.19 Package: linux-aws Package: linux-aws-5.0 Package: linux-aws-5.11 Package: linux-aws-5.13 Package: linux-aws-5.19 Package: linux-aws-5.3 Package: linux-aws-5.8 Package: linux-aws-6.14 Package: linux-aws-6.2 Package: linux-aws-6.5 Package: linux-aws-6.8 Package: linux-aws-fips Package: linux-azure Package: linux-azure-5.11 Package: linux-azure-5.13 Package: linux-azure-5.19 Package: linux-azure-5.3 Package: linux-azure-5.8 Package: linux-azure-6.11 Package: linux-azure-6.14 Package: linux-azure-6.2 Package: linux-azure-6.5 Package: linux-azure-6.8 Package: linux-azure-edge Package: linux-azure-fde Package: linux-azure-fde-5.19 Package: linux-azure-fde-6.14 Package: linux-azure-fde-6.2 Package: linux-azure-fde-6.8 Package: linux-azure-fips Package: linux-azure-nvidia Package: linux-azure-nvidia-6.14 Package: linux-bluefield Package: linux-fips Package: linux-gcp Package: linux-gcp-5.11 Package: linux-gcp-5.13 Package: linux-gcp-5.19 Package: linux-gcp-5.3 Package: linux-gcp-5.8 Package: linux-gcp-6.11 Package: linux-gcp-6.14 Package: linux-gcp-6.2 Package: linux-gcp-6.5 Package: linux-gcp-6.8 Package: linux-gcp-fips Package: linux-gke Package: linux-gke-4.15 Package: linux-gke-5.15 Package: linux-gke-5.4 Package: linux-gkeop Package: linux-gkeop-5.15 Package: linux-gkeop-5.4 Package: linux-hwe Package: linux-hwe-5.11 Package: linux-hwe-5.13 Package: linux-hwe-5.19 Package: linux-hwe-5.8 Package: linux-hwe-6.11 Package: linux-hwe-6.2 Package: linux-hwe-6.5 Package: linux-hwe-6.8 Package: linux-hwe-edge Package: linux-ibm Package: linux-ibm-6.8 Package: linux-intel Package: linux-intel-5.13 Package: linux-intel-iot-realtime Package: linux-lowlatency Package: linux-lowlatency-hwe-5.19 Package: linux-lowlatency-hwe-6.11 Package: linux-lowlatency-hwe-6.2 Package: linux-lowlatency-hwe-6.5 Package: linux-lowlatency-hwe-6.8 Package: linux-nvidia Package: linux-nvidia-6.11 Package: linux-nvidia-6.2 Package: linux-nvidia-6.5 Package: linux-nvidia-6.8 Package: linux-nvidia-lowlatency Package: linux-nvidia-tegra Package: linux-oem Package: linux-oem-5.10 Package: linux-oem-5.13 Package: linux-oem-5.14 Package: linux-oem-5.17 Package: linux-oem-5.6 Package: linux-oem-6.0 Package: linux-oem-6.1 Package: linux-oem-6.11 Package: linux-oem-6.14 Package: linux-oem-6.5 Package: linux-oem-6.8 Package: linux-oracle Package: linux-oracle-5.0 Package: linux-oracle-5.11 Package: linux-oracle-5.13 Package: linux-oracle-5.3 Package: linux-oracle-5.8 Package: linux-oracle-6.14 Package: linux-oracle-6.5 Package: linux-oracle-6.8 Package: linux-raspi Package: linux-raspi-realtime Package: linux-raspi2 Package: linux-realtime Package: linux-realtime-6.14 Package: linux-realtime-6.8 Package: linux-riscv Package: linux-riscv-5.11 Package: linux-riscv-5.19 Package: linux-riscv-5.8 Package: linux-riscv-6.14 Package: linux-riscv-6.5 Package: linux-riscv-6.8 Package: linux-starfive-5.19 Package: linux-starfive-6.2 Package: linux-starfive-6.5 Package: linux-vmware Package: linux-xilinx Platform: Linux Ecosystem: Azure Linux Ecosystem: Debian Ecosystem: Ubuntu

Description

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

btrfs: fix assertion when building free space tree

When building the free space tree with the block group tree feature
enabled, we can hit an assertion failure like this:

BTRFS info (device loop0 state M): rebuilding free space tree
assertion failed: ret == 0, in fs/btrfs/free-space-tree.c:1102
------------[ cut here ]------------
kernel BUG at fs/btrfs/free-space-tree.c:1102!
Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
Modules linked in:
CPU: 1 UID: 0 PID: 6592 Comm: syz-executor322 Not tainted 6.15.0-rc7-syzkaller-gd7fa1af5b33e #0 PREEMPT
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : populate_free_space_tree+0x514/0x518 fs/btrfs/free-space-tree.c:1102
lr : populate_free_space_tree+0x514/0x518 fs/btrfs/free-space-tree.c:1102
sp : ffff8000a4ce7600
x29: ffff8000a4ce76e0 x28: ffff0000c9bc6000 x27: ffff0000ddfff3d8
x26: ffff0000ddfff378 x25: dfff800000000000 x24: 0000000000000001
x23: ffff8000a4ce7660 x22: ffff70001499cecc x21: ffff0000e1d8c160
x20: ffff0000e1cb7800 x19: ffff0000e1d8c0b0 x18: 00000000ffffffff
x17: ffff800092f39000 x16: ffff80008ad27e48 x15: ffff700011e740c0
x14: 1ffff00011e740c0 x13: 0000000000000004 x12: ffffffffffffffff
x11: ffff700011e740c0 x10: 0000000000ff0100 x9 : 94ef24f55d2dbc00
x8 : 94ef24f55d2dbc00 x7 : 0000000000000001 x6 : 0000000000000001
x5 : ffff8000a4ce6f98 x4 : ffff80008f415ba0 x3 : ffff800080548ef0
x2 : 0000000000000000 x1 : 0000000100000000 x0 : 000000000000003e
Call trace:
populate_free_space_tree+0x514/0x518 fs/btrfs/free-space-tree.c:1102 (P)
btrfs_rebuild_free_space_tree+0x14c/0x54c fs/btrfs/free-space-tree.c:1337
btrfs_start_pre_rw_mount+0xa78/0xe10 fs/btrfs/disk-io.c:3074
btrfs_remount_rw fs/btrfs/super.c:1319 [inline]
btrfs_reconfigure+0x828/0x2418 fs/btrfs/super.c:1543
reconfigure_super+0x1d4/0x6f0 fs/super.c:1083
do_remount fs/namespace.c:3365 [inline]
path_mount+0xb34/0xde0 fs/namespace.c:4200
do_mount fs/namespace.c:4221 [inline]
__do_sys_mount fs/namespace.c:4432 [inline]
__se_sys_mount fs/namespace.c:4409 [inline]
__arm64_sys_mount+0x3e8/0x468 fs/namespace.c:4409
__invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49
el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132
do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151
el0_svc+0x58/0x17c arch/arm64/kernel/entry-common.c:767
el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:786
el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600
Code: f0047182 91178042 528089c3 9771d47b (d4210000)
---[ end trace 0000000000000000 ]---

This happens because we are processing an empty block group, which has
no extents allocated from it, there are no items for this block group,
including the block group item since block group items are stored in a
dedicated tree when using the block group tree feature. It also means
this is the block group with the highest start offset, so there are no
higher keys in the extent root, hence btrfs_search_slot_for_read()
returns 1 (no higher key found).

Fix this by asserting 'ret' is 0 only if the block group tree feature
is not enabled, in which case we should find a block group item for
the block group since it's stored in the extent root and block group
item keys are greater than extent item keys (the value for
BTRFS_BLOCK_GROUP_ITEM_KEY is 192 and for BTRFS_EXTENT_ITEM_KEY and
BTRFS_METADATA_ITEM_KEY the values are 168 and 169 respectively).
In case 'ret' is 1, we just need to add a record to the free space
tree which spans the whole block group, and we can achieve this by
making 'ret == 0' as the while loop's condition.

Affected products

VendorProductAffectedFixed
Linux Linux 6.0.19 – < 6.1, 6.1 6.1

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 linux 6.16.3-1 —
Debian 13 linux 6.12.41-1 —
Debian 12 linux 6.1.147-1 —
Debian 11 linux-6.1 6.1.153-1~deb11u1 DLA-4328-1
ReleasePackageFixed inAdvisory
Ubuntu Nvidia-BlueField 24.04 LTS linux-bluefield 6.8.0-1016.20 —
Ubuntu 25.10 linux-azure-fde No fix yet —
Ubuntu 24.04 LTS linux 6.8.0-100.100 USN-8028-1
Ubuntu 24.04 LTS linux-aws +1 6.8.0-1046.49 USN-8028-5
Ubuntu 24.04 LTS linux-aws-6.14 +2 6.14.0-1017.17~24.04.1 USN-7934-1, USN-7879-3
Ubuntu 24.04 LTS linux-azure 6.8.0-1046.52 USN-8074-1
Ubuntu 24.04 LTS linux-azure-fde 6.8.0-1046.53 —
Ubuntu 24.04 LTS linux-azure-nvidia 6.8.0-1039.42 —
Ubuntu 24.04 LTS linux-gcp 6.8.0-1047.50 USN-8031-3
Ubuntu 24.04 LTS linux-gcp-6.14 6.14.0-1020.21~24.04.1 USN-7879-4
Ubuntu 24.04 LTS linux-gke 6.8.0-1043.48 USN-8031-3
Ubuntu 24.04 LTS linux-gkeop 6.8.0-1030.33 USN-8028-5
Ubuntu 24.04 LTS linux-hwe-6.14 6.14.0-36.36~24.04.1 USN-7879-1
Ubuntu 24.04 LTS linux-ibm 6.8.0-1044.44 USN-8028-8
Ubuntu 24.04 LTS linux-intel +12 No fix yet —
Ubuntu 24.04 LTS linux-lowlatency 6.8.0-100.100.1 USN-8052-1
Ubuntu 24.04 LTS linux-nvidia-lowlatency 6.8.0-1046.49.1 USN-8028-7
Ubuntu 24.04 LTS linux-nvidia-tegra 6.8.0-1020.20 —
Ubuntu 24.04 LTS linux-oem-6.14 6.14.0-1016.16 USN-7880-1
Ubuntu 24.04 LTS linux-oracle 6.8.0-1043.44 USN-8028-5
Ubuntu 24.04 LTS linux-raspi 6.8.0-1047.51 USN-8028-1
Ubuntu 24.04 LTS linux-riscv-6.14 6.14.0-36.36.1~24.04.1 —
Ubuntu 24.04 LTS linux-xilinx 6.8.0-1023.24 USN-8052-2
Ubuntu 22.04 LTS linux-aws-6.8 +1 6.8.0-1046.49~22.04.1 USN-8028-5
Ubuntu 22.04 LTS linux-azure-6.8 6.8.0-1051.57~22.04.1 USN-8126-1
Ubuntu 22.04 LTS linux-azure-fde-6.8 6.8.0-1046.53~22.04.1 —
Ubuntu 22.04 LTS linux-gcp-6.8 6.8.0-1047.50~22.04.2 USN-8031-1
Ubuntu 22.04 LTS linux-hwe-6.8 +1 6.8.0-100.100~22.04.1 USN-8028-6
Ubuntu 22.04 LTS linux-ibm-6.8 6.8.0-1044.44~22.04.1 USN-8028-8
Ubuntu 22.04 LTS linux-lowlatency-hwe-6.8 6.8.0-100.100.1~22.04.1 USN-8028-6
Ubuntu 22.04 LTS linux-oracle-6.8 6.8.0-1043.44~22.04.1 USN-8028-5
Ubuntu 22.04 LTS linux-riscv +32 No fix yet —
Ubuntu 20.04 LTS linux-gke +28 No fix yet —
Show 5 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu 18.04 LTS linux-gcp +14 No fix yet —
Ubuntu 16.04 LTS linux-hwe-edge No fix yet —
Ubuntu Pro Realtime 24.04 LTS linux-raspi-realtime 6.8.0-2037.38 USN-8028-3
Ubuntu Pro Realtime 24.04 LTS linux-realtime 6.8.1-1041.42 USN-8028-3
Ubuntu Pro Realtime 24.04 LTS linux-realtime-6.14 6.14.0-1016.16~24.04.1 USN-7879-2
Ubuntu Pro Realtime 22.04 LTS linux-realtime-6.8 6.8.1-1041.42~22.04.1 USN-8028-2
Ubuntu Pro FIPS-updates 24.04 LTS linux-aws-fips 6.8.0-1046.49+fips1 USN-8028-4
Ubuntu Pro FIPS-updates 24.04 LTS linux-azure-fips 6.8.0-1046.52+fips1 USN-8074-2
Ubuntu Pro FIPS-updates 24.04 LTS linux-fips 6.8.0-100.100+fips1 USN-8028-4
Ubuntu Pro FIPS-updates 24.04 LTS linux-gcp-fips 6.8.0-1047.50+fips1 USN-8031-2
ReleasePackageFixed inAdvisory
SLES 15 SP7 kernel-64kb +6 6.4.0-150700.53.16.1 SUSE-SU-2025:03290-1
SLES 15 SP7 kernel-azure +1 6.4.0-150700.20.15.2 SUSE-SU-2025:03633-1
SLES 15 SP7 kernel-default-base 6.4.0-150700.53.16.1.150700.17.11.2 SUSE-SU-2025:03290-1
SLES 15 SP7 kernel-syms-azure 6.4.0-150700.20.15.1 SUSE-SU-2025:03633-1
SLES 15 SP6 kernel-64kb +6 6.4.0-150600.23.70.1 SUSE-SU-2025:03301-1
SLES 15 SP6 kernel-azure +2 6.4.0-150600.8.52.1 SUSE-SU-2025:03634-1
SLES 15 SP6 kernel-coco +3 6.4.0-15061.32.coco15sp6.1 SUSE-SU-2025:03602-1
SLES 15 SP6 kernel-default-base 6.4.0-150600.23.70.1.150600.12.30.2 SUSE-SU-2025:03301-1
Show 9 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 16.0 kernel-64kb +7 6.12.0-160000.6.1 SUSE-SU-2025:21139-1
SLES for SAP 16.0 kernel-default-base 6.12.0-160000.6.1.160000.2.4 SUSE-SU-2025:21139-1
SLES 16.0 kernel-64kb +7 6.12.0-160000.6.1 SUSE-SU-2025:21179-1, SUSE-SU-2025:21139-1
SLES 16.0 kernel-default-base 6.12.0-160000.6.1.160000.2.4 SUSE-SU-2025:21139-1
SLE Micro 6.2 kernel-default-base 6.12.0-160000.6.1.160000.2.4 SUSE-SU-2025:21074-1
SLE Micro 6.2 kernel-rt +5 6.12.0-160000.6.1 SUSE-SU-2026:20560-1, SUSE-SU-2025:21074-1
SLE Micro 6.1 kernel-default-base 6.4.0-34.1.21.11 SUSE-SU-2025:20669-1
SLE Micro 6.1 kernel-rt +1 6.4.0-36.1 SUSE-SU-2025:20756-1
SLE Micro 6.1 kernel-source +2 6.4.0-34.1 SUSE-SU-2025:20669-1
SLE Micro 6.0 kernel-default-base 6.4.0-34.1.21.11 SUSE-SU-2025:20653-1
SLE Micro 6.0 kernel-rt +1 6.4.0-36.1 SUSE-SU-2025:20739-1
SLE Micro 6.0 kernel-source +2 6.4.0-34.1 SUSE-SU-2025:20653-1
SLE Live Patching 15 SP7 kernel-default 6.4.0-150700.53.16.1 SUSE-SU-2025:03290-1
SLE Live Patching 15 SP7 kernel-livepatch-SLE15-SP7-RT_Update_4 1-150700.1.3.2 SUSE-SU-2025:03382-1
SLE Live Patching 15 SP7 kernel-livepatch-SLE15-SP7_Update_4 1-150700.15.3.2 SUSE-SU-2025:03290-1
SLE Live Patching 15 SP6 kernel-default 6.4.0-150600.23.70.1 SUSE-SU-2025:03301-1
SLE Live Patching 15 SP6 kernel-livepatch-SLE15-SP6-RT_Update_15 1-150600.1.3.1 SUSE-SU-2025:03272-1
SLE Live Patching 15 SP6 kernel-livepatch-SLE15-SP6_Update_15 1-150600.13.3.2 SUSE-SU-2025:03301-1
SUSE Real Time Module 15 SP7 kernel-rt +2 6.4.0-150700.7.16.1 SUSE-SU-2025:03382-1
SUSE Real Time Module 15 SP6 kernel-rt +3 6.4.0-150600.10.52.1 SUSE-SU-2025:03272-1
ReleasePackageFixed inAdvisory
openSUSE Leap 16.0 kernel-default-base 6.12.0-160000.6.1.160000.2.4 openSUSE-SU-2025:20081-1
openSUSE Leap 16.0 kernel-rt +10 6.12.0-160000.6.1 openSUSE-SU-2025:20081-1
openSUSE Leap 15.6 dtb-aarch64 +10 6.4.0-150600.23.70.1 SUSE-SU-2025:03301-1
openSUSE Leap 15.6 kernel-azure +2 6.4.0-150600.8.52.1 SUSE-SU-2025:03634-1
openSUSE Leap 15.6 kernel-default-base 6.4.0-150600.23.70.1.150600.12.30.2 SUSE-SU-2025:03301-1
openSUSE Leap 15.6 kernel-rt +3 6.4.0-150600.10.52.1 SUSE-SU-2025:03272-1

Amazon Linux

ReleasePackageFixed inAdvisory
Amazon Linux 2023 kernel-livepatch-6.12.40-63.114 +1 1:1.0-0.amzn2023 ALAS2023-2025-1145, ALAS2023-2025-1144
Amazon Linux 2023 perf +14 1:6.1.147-172.266.amzn2023 ALAS2023-2025-1144
Amazon Linux 2023 perf6.12 +14 1:6.12.40-63.114.amzn2023 ALAS2023-2025-1145

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 3 kernel 6.6.104.2-1 —

Oracle Linux

ReleasePackageFixed inAdvisory
Oracle Linux 9 kernel-uek +34 6.12.0-103.40.4.1.el10uek ELSA-2025-20551

Advisories 43

References