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 kernel-headersUpgrade kernel6.12-debuginfo-common-aarch64Upgrade perfUpgrade kernel-tools-develUpgrade python3-perfUpgrade kernel6.12-modules-extraUpgrade python3-perf-debuginfoUpgrade python3-perf6.12Upgrade kernel6.12-debuginfo-common-x86_64Upgrade kernel-libbpfUpgrade kernel-modules-extraUpgrade kernel-livepatch-6.12.37-61.105Upgrade kernel6.12-headersUpgrade perf6.12-debuginfoUpgrade kernel6.12Upgrade kernel6.12-develUpgrade kernel-debuginfoUpgrade kernel6.12-toolsUpgrade kernel6.12-tools-develUpgrade kernel6.12-debuginfoUpgrade kernel-develUpgrade bpftool6.12-debuginfoUpgrade kernel-debuginfo-common-aarch64Upgrade bpftool-debuginfoUpgrade kernel6.12-modules-extra-commonUpgrade kernel6.12-libbpf-debuginfoUpgrade perf-debuginfoUpgrade bpftoolUpgrade kernel-tools-debuginfoUpgrade perf6.12Upgrade kernel6.12-libbpf-staticUpgrade kernel-libbpf-debuginfoUpgrade kernel-modules-extra-commonUpgrade kernel-livepatch-6.1.144-170.251Upgrade kernel-libbpf-staticUpgrade bpftool6.12Upgrade kernel6.12-libbpfUpgrade python3-perf6.12-debuginfoUpgrade kernel-libbpf-develUpgrade kernel6.12-libbpf-develUpgrade kernel-toolsUpgrade kernelUpgrade kernel6.12-tools-debuginfoUpgrade kernel-debuginfo-common-x86_64 | Sep 9, 2025 | Jul 25, 2025 |
| Debian | — | Upgrade linux-6.1Upgrade linux | Jul 28, 2025 | Jul 28, 2025 |
| Suse | — | Upgrade kernel-rt-optionalUpgrade kernel-azure-optionalUpgrade kernel-debugUpgrade gfs2-kmp-64kbUpgrade dtb-hisiliconUpgrade dtb-xilinxUpgrade gfs2-kmp-rtUpgrade kernel-default-vdsoUpgrade kernel-kvmsmall-develUpgrade kernel-default-livepatchUpgrade cluster-md-kmp-rtUpgrade kernel-64kb-optionalUpgrade ocfs2-kmp-64kbUpgrade ocfs2-kmp-defaultUpgrade dlm-kmp-64kbUpgrade gfs2-kmp-azureUpgrade kernel-azure-extraUpgrade kernel-docs-htmlUpgrade kernel-devel-azureUpgrade kernel-source-vanillaUpgrade dtb-caviumUpgrade kernel-64kbUpgrade kernel-default-optionalUpgrade kernel-rt_debug-develUpgrade kernel-zfcpdumpUpgrade kselftests-kmp-azureUpgrade kernel-kvmsmall-vdsoUpgrade kernel-rtUpgrade kernel-source-rtUpgrade dtb-exynosUpgrade kernel-azure-develUpgrade cluster-md-kmp-azureUpgrade dtb-allwinnerUpgrade dtb-freescaleUpgrade gfs2-kmp-defaultUpgrade kernel-develUpgrade dtb-lgUpgrade kernel-obs-buildUpgrade kernel-rt-vdsoUpgrade dtb-qcomUpgrade kernel-default-develUpgrade dtb-alteraUpgrade dtb-amazonUpgrade kernel-azureUpgrade dtb-broadcomUpgrade kselftests-kmp-64kbUpgrade ocfs2-kmp-azureUpgrade kernel-syms-azureUpgrade kernel-rt-livepatchUpgrade kernel-sourceUpgrade kernel-source-azureUpgrade reiserfs-kmp-64kbUpgrade kernel-default-base-rebuildUpgrade kernel-debug-vdsoUpgrade kernel-rt-extraUpgrade kernel-kvmsmallUpgrade kernel-rt-livepatch-develUpgrade dtb-amdUpgrade cluster-md-kmp-defaultUpgrade dtb-renesasUpgrade dtb-armUpgrade dtb-socionextUpgrade kernel-azure-vdsoUpgrade dtb-appleUpgrade kernel-rt_debug-vdsoUpgrade dlm-kmp-rtUpgrade dlm-kmp-defaultUpgrade kselftests-kmp-rtUpgrade kernel-64kb-extraUpgrade dtb-nvidiaUpgrade reiserfs-kmp-rtUpgrade kernel-rt_debugUpgrade kernel-obs-qaUpgrade kernel-macrosUpgrade dtb-apmUpgrade cluster-md-kmp-64kbUpgrade kernel-docsUpgrade kernel-debug-develUpgrade kernel-rt-develUpgrade kernel-64kb-develUpgrade reiserfs-kmp-defaultUpgrade ocfs2-kmp-rtUpgrade kernel-default-livepatch-develUpgrade kernel-defaultUpgrade dtb-sprdUpgrade dtb-rockchipUpgrade dtb-amlogicUpgrade kernel-default-extraUpgrade kernel-default-baseUpgrade dtb-mediatekUpgrade dtb-marvellUpgrade kernel-syms-rtUpgrade kernel-devel-rtUpgrade dlm-kmp-azureUpgrade reiserfs-kmp-azureUpgrade kselftests-kmp-defaultUpgrade kernel-syms | Dec 5, 2025 | Aug 18, 2025 |
| Ubuntu | — | Upgrade linux-image-nvidia-64k-hwe-22.04Upgrade linux-image-oem-22.04Upgrade linux-image-raspi-realtime-6.8Upgrade linux-image-oem-24.04bUpgrade linux-image-ibmUpgrade linux-image-oracle-64k-6.8Upgrade linux-image-oem-24.04Upgrade linux-image-azure-6.14Upgrade linux-image-nvidia-6.8Upgrade linux-image-6.8.0-1046-nvidia-lowlatencyUpgrade linux-image-6.8.0-1046-nvidia-64kUpgrade linux-image-generic-lpaeUpgrade linux-image-oem-22.04aUpgrade linux-image-gkeopUpgrade linux-image-nvidiaUpgrade linux-image-6.14.0-34-generic-64kUpgrade linux-image-aws-fipsUpgrade linux-image-nvidia-lowlatency-64kUpgrade linux-image-oracle-lts-24.04Upgrade linux-image-6.8.0-1030-gkeopUpgrade linux-image-6.8.0-1046-aws-64kUpgrade linux-image-azure-nvidiaUpgrade linux-image-6.14.0-1015-oracle-64kUpgrade linux-image-xilinx-zynqmpUpgrade linux-image-6.14.0-1018-gcp-64kUpgrade linux-image-6.8.0-100-genericUpgrade linux-image-6.8.0-1046-azureUpgrade linux-image-6.8.0-1046-nvidia-lowlatency-64kUpgrade linux-image-lowlatency-hwe-22.04Upgrade linux-image-generic-64k-hwe-24.04Upgrade linux-image-lowlatency-64kUpgrade linux-image-gkeUpgrade linux-image-oem-6.14Upgrade linux-image-nvidia-64k-6.8Upgrade linux-image-virtualUpgrade linux-image-6.8.0-100-generic-64kUpgrade linux-image-generic-64kUpgrade linux-image-6.8.0-1047-gcpUpgrade linux-image-6.8.0-1023-xilinxUpgrade linux-image-6.8.0-1043-gke-64kUpgrade linux-image-azure-lts-24.04Upgrade linux-image-6.8.0-1051-azureUpgrade linux-image-gkeop-6.8Upgrade linux-image-gcp-64k-lts-24.04Upgrade linux-image-gcp-6.8Upgrade linux-image-oracleUpgrade linux-image-6.8.0-100-lowlatencyUpgrade linux-image-6.8.0-2037-raspi-realtimeUpgrade linux-image-fipsUpgrade linux-image-gke-64kUpgrade linux-image-6.14.0-1015-oracleUpgrade linux-image-6.8.0-1044-ibmUpgrade linux-image-nvidia-lowlatencyUpgrade linux-image-nvidia-lowlatency-6.8Upgrade linux-image-lowlatencyUpgrade linux-image-oracle-6.14Upgrade linux-image-genericUpgrade linux-image-lowlatency-6.8Upgrade linux-image-ibm-classicUpgrade linux-image-oracle-64k-lts-24.04Upgrade linux-image-6.8.0-1047-gcp-64kUpgrade linux-image-oracle-6.8Upgrade linux-image-azure-fipsUpgrade linux-image-aws-64k-6.14Upgrade linux-image-gcpUpgrade linux-image-6.8.0-1046-awsUpgrade linux-image-6.14.0-1016-raspiUpgrade linux-image-generic-hwe-24.04Upgrade linux-image-gcp-64k-6.14Upgrade linux-image-6.14.0-1018-gcpUpgrade linux-image-6.8.0-1046-nvidiaUpgrade linux-image-azure-6.8Upgrade linux-image-realtime-6.14Upgrade linux-image-realtime-6.8.1Upgrade linux-image-ibm-6.8Upgrade linux-image-oracle-64kUpgrade linux-image-kvmUpgrade linux-image-aws-lts-24.04Upgrade linux-image-6.14.0-1014-azureUpgrade linux-image-6.14.0-1014-oemUpgrade linux-image-realtime-hwe-24.04Upgrade linux-image-intel-iot-realtimeUpgrade linux-image-gcp-lts-24.04Upgrade linux-image-virtual-hwe-24.04Upgrade linux-image-aws-64k-6.8Upgrade linux-image-azure-nvidia-6.14Upgrade linux-image-nvidia-hwe-22.04Upgrade linux-image-xilinx-6.8Upgrade linux-image-aws-fips-6.8Upgrade linux-image-gke-64k-6.8Upgrade linux-image-virtual-6.14Upgrade linux-image-generic-64k-6.8Upgrade linux-image-6.8.0-1047-gcp-fipsUpgrade linux-image-gke-6.8Upgrade linux-image-raspi-realtimeUpgrade linux-image-azureUpgrade linux-image-oracle-64k-6.14Upgrade linux-image-oem-24.04cUpgrade linux-image-raspi-6.14Upgrade linux-image-oem-24.04aUpgrade linux-image-oem-22.04bUpgrade linux-image-intel-iotgUpgrade linux-image-generic-64k-6.14Upgrade linux-image-fips-6.8Upgrade linux-image-gcp-6.14Upgrade linux-image-6.8.0-1046-azure-fipsUpgrade linux-image-xilinxUpgrade linux-image-oem-22.04dUpgrade linux-image-aws-64k-lts-24.04Upgrade linux-image-gcp-64k-6.8Upgrade linux-image-6.8.1-1041-realtimeUpgrade linux-image-nvidia-lowlatency-64k-6.8Upgrade linux-image-6.8.0-1043-gkeUpgrade linux-image-6.14.0-34-genericUpgrade linux-image-aws-64kUpgrade linux-image-aws-6.14Upgrade linux-image-6.8.0-1043-oracle-64kUpgrade linux-image-6.14.0-1015-aws-64kUpgrade linux-image-6.14.0-1015-awsUpgrade linux-image-6.14.0-1007-azure-nvidiaUpgrade linux-image-gcp-fips-6.8Upgrade linux-image-aws-6.8Upgrade linux-image-gcp-64kUpgrade linux-image-realtimeUpgrade linux-image-nvidia-64kUpgrade linux-image-realtime-hwe-22.04Upgrade 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-6.14.0-1014-realtimeUpgrade linux-image-lowlatency-64k-6.8Upgrade linux-image-oem-22.04cUpgrade linux-image-6.8.0-1047-raspiUpgrade linux-image-6.8.0-1046-aws-fipsUpgrade linux-image-generic-hwe-22.04Upgrade linux-image-generic-64k-hwe-22.04Upgrade linux-image-generic-6.8Upgrade linux-image-lowlatency-64k-hwe-22.04Upgrade linux-image-generic-6.14Upgrade linux-image-gcp-fipsUpgrade linux-image-virtual-hwe-22.04Upgrade linux-image-virtual-6.8Upgrade linux-image-raspi-6.8Upgrade linux-image-raspi | 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