In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix adding block group to a reclaim list and the unused list during reclaim
There is a potential parallel list adding for retrying in btrfs_reclaim_bgs_work and adding to the unused list. Since the block group is removed from the reclaim list and it is on a relocation work, it can be added into the unused list in parallel. When that happens, adding it to the reclaim list will corrupt the list head and trigger list corruption like below.
Fix it by taking fs_info->unused_bgs_lock.
[177.504][T2585409] BTRFS error (device nullb1): error relocating ch= unk 2415919104 [177.514][T2585409] list_del corruption. next->prev should be ff1100= 0344b119c0, but was ff11000377e87c70. (next=3Dff110002390cd9c0) [177.529][T2585409] ------------[ cut here ]------------ [177.537][T2585409] kernel BUG at lib/list_debug.c:65! [177.545][T2585409] Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI [177.555][T2585409] CPU: 9 PID: 2585409 Comm: kworker/u128:2 Tainted: G W 6.10.0-rc5-kts #1 [177.568][T2585409] Hardware name: Supermicro SYS-520P-WTR/X12SPW-TF, BIOS 1.2 02/14/2022 [177.579][T2585409] Workqueue: events_unbound btrfs_reclaim_bgs_work[btrfs] [177.589][T2585409] RIP: 0010:__list_del_entry_valid_or_report.cold+0x70/0x72 [177.624][T2585409] RSP: 0018:ff11000377e87a70 EFLAGS: 00010286 [177.633][T2585409] RAX: 000000000000006d RBX: ff11000344b119c0 RCX:0000000000000000 [177.644][T2585409] RDX: 000000000000006d RSI: 0000000000000008 RDI:ffe21c006efd0f40 [177.655][T2585409] RBP: ff110002e0509f78 R08: 0000000000000001 R09:ffe21c006efd0f08 [177.665][T2585409] R10: ff11000377e87847 R11: 0000000000000000 R12:ff110002390cd9c0 [177.676][T2585409] R13: ff11000344b119c0 R14: ff110002e0508000 R15:dffffc0000000000 [177.687][T2585409] FS: 0000000000000000(0000) GS:ff11000fec880000(0000) knlGS:0000000000000000 [177.700][T2585409] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [177.709][T2585409] CR2: 00007f06bc7b1978 CR3: 0000001021e86005 CR4:0000000000771ef0 [177.720][T2585409] DR0: 0000000000000000 DR1: 0000000000000000 DR2:0000000000000000 [177.731][T2585409] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:0000000000000400 [177.742][T2585409] PKRU: 55555554 [177.748][T2585409] Call Trace: [177.753][T2585409] <TASK> [177.759][T2585409] ? __die_body.cold+0x19/0x27 [177.766][T2585409] ? die+0x2e/0x50 [177.772][T2585409] ? do_trap+0x1ea/0x2d0 [177.779][T2585409] ? __list_del_entry_valid_or_report.cold+0x70/0x72 [177.788][T2585409] ? do_error_trap+0xa3/0x160 [177.795][T2585409] ? __list_del_entry_valid_or_report.cold+0x70/0x72 [177.805][T2585409] ? handle_invalid_op+0x2c/0x40 [177.812][T2585409] ? __list_del_entry_valid_or_report.cold+0x70/0x72 [177.820][T2585409] ? exc_invalid_op+0x2d/0x40 [177.827][T2585409] ? asm_exc_invalid_op+0x1a/0x20 [177.834][T2585409] ? __list_del_entry_valid_or_report.cold+0x70/0x72 [177.843][T2585409] btrfs_delete_unused_bgs+0x3d9/0x14c0 [btrfs]
There is a similar retry_list code in btrfs_delete_unused_bgs(), but it is safe, AFAICS. Since the block group was in the unused list, the used bytes should be 0 when it was added to the unused list. Then, it checks block_group->{used,reserved,pinned} are still 0 under the block_group->lock. So, they should be still eligible for the unused list, not the reclaim list.
The reason it is safe there it's because because we're holding space_info->groups_sem in write mode.
That means no other task can allocate from the block group, so while we are at deleted_unused_bgs() it's not possible for other tasks to allocate and deallocate extents from the block group, so it can't be added to the unused list or the reclaim list by anyone else.
The bug can be reproduced by btrfs/166 after a few rounds. In practice this can be hit when relocation cannot find more chunk space and ends with ENOSPC.
CVSS Details
- CVSS 3.1 Base Score: 7.8
- CVSS 3.1 Vector: (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)
Covered by Rapid7
| Product | Vendor Advisory | Solution File | Added | Published |
|---|---|---|---|---|
| Amazon Linux Ami 2 | — | Upgrade kernel-debuginfo-common-x86_64Upgrade kernel-toolsUpgrade bpftool-debuginfoUpgrade kernelUpgrade kernel-headersUpgrade python-perf-debuginfoUpgrade python-perfUpgrade kernel-livepatch-5.15.164-108.161Upgrade perf-debuginfoUpgrade kernel-develUpgrade kernel-tools-develUpgrade perfUpgrade kernel-debuginfoUpgrade kernel-debuginfo-common-aarch64Upgrade kernel-tools-debuginfoUpgrade bpftool | May 20, 2026 | May 20, 2026 |
| Amazon_linux_2023 | — | Upgrade bpftool-debuginfoUpgrade kernel-modules-extraUpgrade kernel-debuginfo-common-x86_64Upgrade kernel-toolsUpgrade bpftoolUpgrade kernel-tools-debuginfoUpgrade kernel-libbpfUpgrade python3-perf-debuginfoUpgrade kernel-libbpf-staticUpgrade kernel-tools-develUpgrade kernel-modules-extra-commonUpgrade kernel-libbpf-develUpgrade kernel-debuginfoUpgrade perf-debuginfoUpgrade kernel-headersUpgrade kernel-livepatch-6.1.102-108.177Upgrade kernel-develUpgrade kernelUpgrade perfUpgrade python3-perfUpgrade kernel-debuginfo-common-aarch64 | Oct 16, 2025 | Jul 30, 2024 |
| Debian | — | Upgrade linux-6.1Upgrade linux | Aug 7, 2024 | Jul 30, 2024 |
| Oracle_linux | — | Upgrade kernel-uek | Oct 16, 2024 | Jul 30, 2024 |
| Redhat_linux | — | No solution exists | Jul 9, 2025 | Jul 30, 2024 |
| Ubuntu | — | Upgrade linux-image-lowlatency-hwe-22.04Upgrade linux-image-nvidia-lowlatency-64kUpgrade linux-image-lowlatency-64kUpgrade linux-image-6.8.0-1017-azureUpgrade linux-image-6.8.0-1016-gcpUpgrade linux-image-6.8.0-1017-nvidia-lowlatencyUpgrade linux-image-nvidiaUpgrade linux-image-raspiUpgrade linux-image-6.8.0-48-genericUpgrade linux-image-generic-lpaeUpgrade linux-image-genericUpgrade linux-image-6.8.0-1013-gkeUpgrade linux-image-nvidia-lowlatencyUpgrade linux-image-azureUpgrade linux-image-6.8.0-1016-azureUpgrade linux-image-nvidia-6.8Upgrade linux-image-azure-fdeUpgrade linux-image-6.8.0-1017-azure-fdeUpgrade linux-image-6.8.0-1017-nvidiaUpgrade linux-image-awsUpgrade linux-image-6.8.0-1016-azure-fdeUpgrade linux-image-generic-64k-hwe-24.04Upgrade linux-image-nvidia-64k-6.8Upgrade linux-image-oem-22.04dUpgrade linux-image-oem-22.04Upgrade linux-image-nvidia-64k-hwe-22.04Upgrade linux-image-oem-22.04aUpgrade linux-image-6.8.0-48-generic-64kUpgrade linux-image-gkeopUpgrade linux-image-oracle-64kUpgrade linux-image-oem-22.04cUpgrade linux-image-6.8.0-1017-nvidia-lowlatency-64kUpgrade linux-image-6.8.0-48-lowlatency-64kUpgrade linux-image-gkeUpgrade linux-image-6.8.0-1014-raspiUpgrade linux-image-6.8.0-1017-nvidia-64kUpgrade linux-image-ibmUpgrade linux-image-lowlatency-64k-hwe-24.04Upgrade linux-image-ibm-classicUpgrade linux-image-generic-hwe-24.04Upgrade linux-image-6.8.0-1014-ibmUpgrade linux-image-nvidia-hwe-22.04Upgrade linux-image-6.8.0-1015-oracleUpgrade linux-image-lowlatencyUpgrade linux-image-oem-22.04bUpgrade linux-image-6.8.0-1002-gkeopUpgrade linux-image-oracleUpgrade linux-image-lowlatency-hwe-24.04Upgrade linux-image-gkeop-6.8Upgrade linux-image-generic-64kUpgrade linux-image-kvmUpgrade linux-image-oem-24.04aUpgrade linux-image-6.8.0-1017-gcpUpgrade linux-image-6.8.0-1018-awsUpgrade linux-image-generic-hwe-22.04Upgrade linux-image-generic-64k-hwe-22.04Upgrade linux-image-virtual-hwe-24.04Upgrade linux-image-virtual-hwe-22.04Upgrade linux-image-ibm-lts-24.04Upgrade linux-image-nvidia-64kUpgrade linux-image-6.8.0-1016-oemUpgrade linux-image-6.8.0-1015-oracle-64kUpgrade linux-image-lowlatency-64k-hwe-22.04Upgrade linux-image-oem-24.04Upgrade linux-image-virtualUpgrade linux-image-6.8.0-48-lowlatencyUpgrade linux-image-gcp | Nov 4, 2024 | Jul 30, 2024 |
| Vmware Photon_os | — | Use 'tdnf update' to upgrade all packages to the latest version. | Jan 20, 2025 | Jul 30, 2024 |
Prioritise with Active Threat Intelligence
With curated Threat Intelligence, you can see which vulnerabilities truly put you at risk, prioritize what matters most, and act before attackers do.
Explore Intelligence Hub