In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix a race between renames and directory logging
We have a race between a rename and directory inode logging that if it happens and we crash/power fail before the rename completes, the next time the filesystem is mounted, the log replay code will end up deleting the file that was being renamed.
This is best explained following a step by step analysis of an interleaving of steps that lead into this situation.
Consider the initial conditions:
1) We are at transaction N;
2) We have directories A and B created in a past transaction (< N);
3) We have inode X corresponding to a file that has 2 hardlinks, one in directory A and the other in directory B, so we'll name them as "A/foo_link1" and "B/foo_link2". Both hard links were persisted in a past transaction (< N);
4) We have inode Y corresponding to a file that as a single hard link and is located in directory A, we'll name it as "A/bar". This file was also persisted in a past transaction (< N).
The steps leading to a file loss are the following and for all of them we are under transaction N:
1) Link "A/foo_link1" is removed, so inode's X last_unlink_trans field is updated to N, through btrfs_unlink() -> btrfs_record_unlink_dir();
2) Task A starts a rename for inode Y, with the goal of renaming from "A/bar" to "A/baz", so we enter btrfs_rename();
3) Task A inserts the new BTRFS_INODE_REF_KEY for inode Y by calling btrfs_insert_inode_ref();
4) Because the rename happens in the same directory, we don't set the last_unlink_trans field of directoty A's inode to the current transaction id, that is, we don't cal btrfs_record_unlink_dir();
5) Task A then removes the entries from directory A (BTRFS_DIR_ITEM_KEY and BTRFS_DIR_INDEX_KEY items) when calling __btrfs_unlink_inode() (actually the dir index item is added as a delayed item, but the effect is the same);
6) Now before task A adds the new entry "A/baz" to directory A by calling btrfs_add_link(), another task, task B is logging inode X;
7) Task B starts a fsync of inode X and after logging inode X, at btrfs_log_inode_parent() it calls btrfs_log_all_parents(), since inode X has a last_unlink_trans value of N, set at in step 1;
8) At btrfs_log_all_parents() we search for all parent directories of inode X using the commit root, so we find directories A and B and log them. Bu when logging direct A, we don't have a dir index item for inode Y anymore, neither the old name "A/bar" nor for the new name "A/baz" since the rename has deleted the old name but has not yet inserted the new name - task A hasn't called yet btrfs_add_link() to do that.
Note that logging directory A doesn't fallback to a transaction commit because its last_unlink_trans has a lower value than the current transaction's id (see step 4);
9) Task B finishes logging directories A and B and gets back to btrfs_sync_file() where it calls btrfs_sync_log() to persist the log tree;
10) Task B successfully persisted the log tree, btrfs_sync_log() completed with success, and a power failure happened.
We have a log tree without any directory entry for inode Y, so the log replay code deletes the entry for inode Y, name "A/bar", from the subvolume tree since it doesn't exist in the log tree and the log tree is authorative for its index (we logged a BTRFS_DIR_LOG_INDEX_KEY item that covers the index range for the dentry that corresponds to "A/bar").
Since there's no other hard link for inode Y and the log replay code deletes the name "A/bar", the file is lost.
The issue wouldn't happen if task B synced the log only after task A called btrfs_log_new_name(), which would update the log with the new name for inode Y ("A/bar").
Fix this by pinning the log root during renames before removing the old directory entry, and unpinning af ---truncated---
CVSS Details
- CVSS 3.1 Base Score: 9.1
- CVSS 3.1 Vector: (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H)
Covered by Rapid7
| Product | Vendor Advisory | Solution File | Added | Published |
|---|---|---|---|---|
| Amazon_linux_2023 | — | Upgrade kernel6.12-develUpgrade kernel6.12-toolsUpgrade perf-debuginfoUpgrade kernel-debuginfo-common-aarch64Upgrade kernel6.12-tools-develUpgrade kernel-modules-extraUpgrade bpftoolUpgrade kernel-tools-debuginfoUpgrade kernel6.12-debuginfoUpgrade perf6.12-debuginfoUpgrade kernel-livepatch-6.12.37-61.105Upgrade kernel6.12Upgrade python3-perf-debuginfoUpgrade kernel6.12-modules-extra-commonUpgrade bpftool-debuginfoUpgrade kernel-debuginfoUpgrade kernel6.12-debuginfo-common-aarch64Upgrade kernel6.12-modules-extraUpgrade python3-perfUpgrade perfUpgrade kernel-tools-develUpgrade kernel-libbpfUpgrade kernel-headersUpgrade kernel6.12-libbpf-debuginfoUpgrade python3-perf6.12Upgrade bpftool6.12-debuginfoUpgrade kernel6.12-headersUpgrade kernel-develUpgrade kernel6.12-debuginfo-common-x86_64Upgrade kernel-debuginfo-common-x86_64Upgrade kernel-libbpf-debuginfoUpgrade bpftool6.12Upgrade kernelUpgrade kernel6.12-tools-debuginfoUpgrade kernel6.12-libbpfUpgrade perf6.12Upgrade kernel6.12-libbpf-staticUpgrade kernel-modules-extra-commonUpgrade kernel-libbpf-staticUpgrade kernel-toolsUpgrade kernel-livepatch-6.1.144-170.251Upgrade kernel-libbpf-develUpgrade kernel6.12-libbpf-develUpgrade python3-perf6.12-debuginfo | Sep 9, 2025 | Jul 25, 2025 |
| Debian | — | Upgrade linux-6.1Upgrade linux | Jul 28, 2025 | Jul 28, 2025 |
| Suse | — | Upgrade reiserfs-kmp-azureUpgrade kernel-symsUpgrade kselftests-kmp-defaultUpgrade dlm-kmp-azureUpgrade kernel-rt_debugUpgrade dlm-kmp-defaultUpgrade reiserfs-kmp-rtUpgrade kernel-rt_debug-vdsoUpgrade kselftests-kmp-rtUpgrade dtb-marvellUpgrade kernel-azure-vdsoUpgrade dtb-socionextUpgrade cluster-md-kmp-defaultUpgrade dtb-mediatekUpgrade dtb-renesasUpgrade kernel-default-extraUpgrade dtb-amdUpgrade kernel-64kb-develUpgrade kernel-docsUpgrade kernel-devel-rtUpgrade dtb-armUpgrade kernel-obs-qaUpgrade kernel-debug-develUpgrade kernel-rt-develUpgrade kernel-macrosUpgrade kernel-rt-livepatch-develUpgrade cluster-md-kmp-64kbUpgrade kernel-syms-rtUpgrade dtb-amlogicUpgrade dtb-rockchipUpgrade reiserfs-kmp-defaultUpgrade ocfs2-kmp-rtUpgrade kernel-kvmsmallUpgrade kernel-defaultUpgrade kernel-default-livepatch-develUpgrade dtb-sprdUpgrade dlm-kmp-rtUpgrade dtb-appleUpgrade dtb-nvidiaUpgrade dtb-apmUpgrade kernel-64kb-extraUpgrade kernel-default-baseUpgrade kernel-source-azureUpgrade kernel-sourceUpgrade kernel-rt-livepatchUpgrade kernel-rt-extraUpgrade kernel-debug-vdsoUpgrade kernel-default-base-rebuildUpgrade kernel-syms-azureUpgrade kernel-azureUpgrade dtb-amazonUpgrade dtb-alteraUpgrade reiserfs-kmp-64kbUpgrade kernel-default-develUpgrade kernel-zfcpdumpUpgrade kernel-64kb-optionalUpgrade dlm-kmp-64kbUpgrade kernel-azure-extraUpgrade gfs2-kmp-azureUpgrade dtb-lgUpgrade kernel-source-vanillaUpgrade kernel-docs-htmlUpgrade kernel-devel-azureUpgrade kernel-kvmsmall-develUpgrade kernel-default-vdsoUpgrade kernel-default-livepatchUpgrade kernel-debugUpgrade gfs2-kmp-64kbUpgrade dtb-hisiliconUpgrade dtb-caviumUpgrade cluster-md-kmp-rtUpgrade ocfs2-kmp-defaultUpgrade ocfs2-kmp-64kbUpgrade kselftests-kmp-azureUpgrade kernel-rt-optionalUpgrade kernel-rt_debug-develUpgrade kernel-default-optionalUpgrade gfs2-kmp-defaultUpgrade kernel-azure-optionalUpgrade dtb-exynosUpgrade cluster-md-kmp-azureUpgrade dtb-allwinnerUpgrade kernel-source-rtUpgrade kernel-rtUpgrade kernel-kvmsmall-vdsoUpgrade kernel-azure-develUpgrade dtb-freescaleUpgrade dtb-xilinxUpgrade kernel-64kbUpgrade kernel-develUpgrade kernel-rt-vdsoUpgrade gfs2-kmp-rtUpgrade kernel-obs-buildUpgrade dtb-qcomUpgrade dtb-broadcomUpgrade ocfs2-kmp-azureUpgrade kselftests-kmp-64kb | Dec 5, 2025 | Aug 18, 2025 |
| Ubuntu | — | Upgrade linux-image-azure-lts-24.04Upgrade linux-image-6.14.0-1015-oracleUpgrade linux-image-6.8.0-1043-gke-64kUpgrade linux-image-6.8.0-1046-azureUpgrade linux-image-nvidia-6.8Upgrade linux-image-6.14.0-34-generic-64kUpgrade linux-image-oem-6.14Upgrade linux-image-generic-64k-hwe-24.04Upgrade linux-image-gkeopUpgrade linux-image-oem-24.04Upgrade linux-image-6.8.0-1023-xilinxUpgrade linux-image-gkeUpgrade linux-image-virtualUpgrade linux-image-6.14.0-1015-oracle-64kUpgrade linux-image-lowlatencyUpgrade linux-image-oracleUpgrade linux-image-6.8.0-100-lowlatencyUpgrade linux-image-xilinx-zynqmpUpgrade linux-image-raspi-realtime-6.8Upgrade linux-image-gcp-64k-lts-24.04Upgrade linux-image-fipsUpgrade linux-image-oracle-64k-lts-24.04Upgrade linux-image-oem-22.04aUpgrade linux-image-oracle-64k-6.8Upgrade linux-image-generic-64kUpgrade linux-image-6.8.0-100-generic-64kUpgrade linux-image-ibm-classicUpgrade linux-image-gkeop-6.8Upgrade linux-image-gcp-6.8Upgrade linux-image-6.8.0-1044-ibmUpgrade linux-image-oem-22.04Upgrade linux-image-6.8.0-1047-gcp-64kUpgrade linux-image-oracle-6.14Upgrade linux-image-aws-fipsUpgrade linux-image-6.8.0-1046-aws-64kUpgrade linux-image-nvidia-lowlatencyUpgrade linux-image-6.8.0-1030-gkeopUpgrade linux-image-nvidia-lowlatency-6.8Upgrade linux-image-oracle-lts-24.04Upgrade linux-image-nvidia-64k-hwe-22.04Upgrade linux-image-gke-64kUpgrade linux-image-6.8.0-1047-gcpUpgrade linux-image-ibmUpgrade linux-image-6.8.0-1046-nvidia-lowlatencyUpgrade linux-image-generic-lpaeUpgrade linux-image-oem-24.04bUpgrade linux-image-6.8.0-1046-nvidia-64kUpgrade linux-image-azure-6.14Upgrade linux-image-nvidiaUpgrade linux-image-lowlatency-6.8Upgrade linux-image-6.8.0-100-genericUpgrade linux-image-nvidia-64k-6.8Upgrade linux-image-lowlatency-hwe-22.04Upgrade linux-image-6.14.0-1018-gcp-64kUpgrade linux-image-lowlatency-64kUpgrade linux-image-6.8.0-1046-nvidia-lowlatency-64kUpgrade linux-image-genericUpgrade linux-image-6.8.0-1051-azureUpgrade linux-image-nvidia-lowlatency-64kUpgrade linux-image-6.8.0-2037-raspi-realtimeUpgrade linux-image-azure-nvidiaUpgrade linux-image-realtime-6.8.1Upgrade linux-image-6.8.1-1041-realtimeUpgrade linux-image-oracle-64kUpgrade linux-image-6.8.0-1046-azure-fipsUpgrade linux-image-6.14.0-1014-oemUpgrade linux-image-aws-lts-24.04Upgrade linux-image-aws-6.8Upgrade linux-image-gcp-6.14Upgrade linux-image-6.14.0-1007-azure-nvidiaUpgrade linux-image-6.14.0-34-genericUpgrade linux-image-aws-64kUpgrade linux-image-oem-22.04bUpgrade linux-image-6.14.0-1015-aws-64kUpgrade linux-image-realtime-hwe-22.04Upgrade linux-image-realtimeUpgrade linux-image-6.14.0-1014-realtimeUpgrade linux-image-lowlatency-64k-6.8Upgrade linux-image-ibm-lts-24.04Upgrade linux-image-azure-fips-6.8Upgrade linux-image-awsUpgrade linux-image-6.8.0-1043-oracleUpgrade linux-image-6.8.0-100-lowlatency-64kUpgrade linux-image-6.8.0-100-fipsUpgrade linux-image-nvidia-64kUpgrade linux-image-aws-6.14Upgrade linux-image-intel-iot-realtimeUpgrade linux-image-realtime-6.14Upgrade linux-image-generic-64k-6.8Upgrade linux-image-aws-fips-6.8Upgrade linux-image-xilinx-6.8Upgrade linux-image-virtual-6.14Upgrade linux-image-realtime-hwe-24.04Upgrade linux-image-gke-64k-6.8Upgrade linux-image-gke-6.8Upgrade linux-image-kvmUpgrade linux-image-6.8.0-1047-gcp-fipsUpgrade linux-image-6.14.0-1014-azureUpgrade linux-image-virtual-hwe-24.04Upgrade linux-image-oracle-6.8Upgrade linux-image-gcp-fips-6.8Upgrade linux-image-xilinxUpgrade linux-image-oem-22.04dUpgrade linux-image-nvidia-lowlatency-64k-6.8Upgrade linux-image-gcpUpgrade linux-image-virtual-6.8Upgrade linux-image-raspiUpgrade linux-image-oem-22.04cUpgrade linux-image-lowlatency-64k-hwe-22.04Upgrade linux-image-generic-64k-hwe-22.04Upgrade linux-image-generic-6.8Upgrade linux-image-generic-6.14Upgrade linux-image-6.8.0-1046-aws-fipsUpgrade linux-image-virtual-hwe-22.04Upgrade linux-image-6.8.0-1043-gkeUpgrade linux-image-oem-24.04aUpgrade linux-image-oem-24.04cUpgrade linux-image-6.8.0-1043-oracle-64kUpgrade linux-image-raspi-6.14Upgrade linux-image-fips-6.8Upgrade linux-image-aws-64k-6.14Upgrade linux-image-oracle-64k-6.14Upgrade linux-image-ibm-6.8Upgrade linux-image-6.8.0-1047-raspiUpgrade linux-image-azure-fipsUpgrade linux-image-6.14.0-1015-awsUpgrade linux-image-intel-iotgUpgrade linux-image-generic-64k-6.14Upgrade linux-image-raspi-6.8Upgrade linux-image-aws-64k-lts-24.04Upgrade linux-image-gcp-64k-6.8Upgrade linux-image-generic-hwe-22.04Upgrade linux-image-gcp-fipsUpgrade linux-image-azure-nvidia-6.14Upgrade linux-image-nvidia-hwe-22.04Upgrade linux-image-azureUpgrade linux-image-gcp-64kUpgrade linux-image-aws-64k-6.8Upgrade linux-image-raspi-realtimeUpgrade linux-image-azure-6.8Upgrade linux-image-6.8.0-1046-nvidiaUpgrade linux-image-6.14.0-1018-gcpUpgrade linux-image-generic-hwe-24.04Upgrade linux-image-6.8.0-1046-awsUpgrade linux-image-gcp-64k-6.14Upgrade linux-image-6.14.0-1016-raspiUpgrade linux-image-gcp-lts-24.04 | Jul 31, 2025 | Jul 25, 2025 |
| Vmware Photon_os | — | Use 'tdnf update' to upgrade all packages to the latest version. | Oct 10, 2025 | Jul 25, 2025 |
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