btrfs: always detect conflicting inodes when logging inode refs
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
048605483fbdd1e77ead32a7cd7b95cc17eaaf0e| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
btrfs: always detect conflicting inodes when logging inode refs
After rename exchanging (either with the rename exchange operation or regular renames in multiple non-atomic steps) two inodes and at least one of them is a directory, we can end up with a log tree that contains only of the inodes and after a power failure that can result in an attempt to delete the other inode when it should not because it was not deleted before the power failure. In some case that delete attempt fails when the target inode is a directory that contains a subvolume inside it, since the log replay code is not prepared to deal with directory entries that point to root items (only inode items).
1) We have directories "dir1" (inode A) and "dir2" (inode B) under the same parent directory;
2) We have a file (inode C) under directory "dir1" (inode A);
3) We have a subvolume inside directory "dir2" (inode B);
4) All these inodes were persisted in a past transaction and we are currently at transaction N;
5) We rename the file (inode C), so at btrfs_log_new_name() we update inode C's last_unlink_trans to N;
From the CVE record · Linux
The Linux kernel’s btrfs inode-reference logging can miss a conflicting inode after directories are renamed. If an affected filesystem is then fsynced and loses power, log replay can attempt to delete a directory containing a subvolume, causing the mount to fail. The input does not describe an attacker access requirement.
Engineers running Linux with btrfs should check their kernel versions; affected versions are not specified in the input.