btrfs: fix reloc root cleanup in merge_reloc_roots()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 1dae7e0e58b484eaa43d530f211098fdeeb0f404 · < 63d6b1f04cd91c825329712aa526215ffa5d11ca| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix reloc root cleanup in merge_reloc_roots()
If the root we got has zero root refs in its root item, we are resetting the root's ->reloc_root without using barriers like we do everywhere else. Sashiko complained about this while reviewing another patch, and it's correct (see the Link tag below).
Also, we should not clear BTRFS_ROOT_DEAD_RELOC_TREE from the root unless the root points to the reloc root we have.
Fix this by using clear_reloc_root(), which issues the memory barrier after setting the root's ->reloc_root to NULL and before clearing the bit BTRFS_ROOT_DEAD_RELOC_TREE from the root.
From the CVE record · Linux
The Linux kernel’s btrfs code can clear a relocation-root pointer without the required memory barrier and may clear a related flag when the root does not point to that relocation root. The input does not describe what an attacker could do or whether exploitation requires local access, authentication, or user interaction.
Engineers running Linux kernels with btrfs should check their kernel vendor’s advisory; affected versions are not specified.