CVE-2023-54180: btrfs: handle case when repair happens with dev-replace
In the Linux kernel, the following vulnerability has been resolved:
btrfs: handle case when repair happens with dev-replace
[BUG]
There is a bug report that a BUG_ON() in btrfs_repair_io_failure()
(originally repair_io_failure() in v6.0 kernel) got triggered when
replacing a unreliable disk:
BTRFS warning (device sda1): csum failed root 257 ino 2397453 off 39624704 csum 0xb0d18c75 expected csum 0x4dae9c5e mirror 3
kernel BUG at fs/btrfs/extent_io.c:2380!
invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
CPU: 9 PID: 3614331 Comm: kworker/u257:2 Tainted: G OE 6.0.0-5-amd64 #1 Debian 6.0.10-2
Hardware name: Micro-Star International Co., Ltd. MS-7C60/TRX40 PRO WIFI (MS-7C60), BIOS 2.70 07/01/2021
Workqueue: btrfs-endio btrfs_end_bio_work [btrfs]
RIP: 0010:repair_io_failure+0x24a/0x260 [btrfs]
Call Trace:
<TASK>
clean_io_failure+0x14d/0x180 [btrfs]
end_bio_extent_readpage+0x412/0x6e0 [btrfs]
? __switch_to+0x106/0x420
process_one_work+0x1c7/0x380
worker_thread+0x4d/0x380
? rescuer_thread+0x3a0/0x3a0
kthread+0xe9/0x110
? kthread_complete_and_exit+0x20/0x20
ret_from_fork+0x22/0x30
[CAUSE]
Before the BUG_ON(), we got some read errors from the replace target
first, note the mirror number (3, which is beyond RAID1 duplication,
thus it's read from the replace target device).
Then at the BUG_ON() location, we are trying to writeback the repaired
sectors back the failed device.
The check looks like this:
ret = btrfs_map_block(fs_info, BTRFS_MAP_WRITE, logical,
&map_length, &bioc, mirror_num);
if (ret)
goto out_counter_dec;
BUG_ON(mirror_num != bioc->mirror_num);
But inside btrfs_map_block(), we can modify bioc->mirror_num especially
for dev-replace:
if (dev_replace_is_ongoing && mirror_num == map->num_stripes + 1 &&
!need_full_stripe(op) && dev_replace->tgtdev != NULL) {
ret = get_extra_mirror_from_replace(fs_info, logical, *length,
dev_replace->srcdev->devid,
&mirror_num,
&physical_to_patch_in_first_stripe);
patch_the_first_stripe_for_dev_replace = 1;
}
Thus if we're repairing the replace target device, we're going to
trigger that BUG_ON().
But in reality, the read failure from the replace target device may be
that, our replace hasn't reached the range we're reading, thus we're
reading garbage, but with replace running, the range would be properly
filled later.
Thus in that case, we don't need to do anything but let the replace
routine to handle it.
[FIX]
Instead of a BUG_ON(), just skip the repair if we're repairing the
device replace target device.
Security readout for executives and security teams
Plain-English summary
This is a Linux kernel Btrfs crash bug during device replacement. If Btrfs tries to repair a read/checksum failure from the replacement target device, an internal assertion can trigger a kernel BUG instead of safely skipping that repair path.
Executive priority
Treat this as a targeted infrastructure reliability issue. Prioritize storage servers, backup systems, NAS hosts, and workstations using Btrfs replacement operations. It is not presented as internet-exploitable in the supplied evidence.
Technical view
The Btrfs repair path calls btrfs_map_block() during dev-replace. That function may change the mirror number for the replacement target, but the caller enforced BUG_ON(mirror_num != bioc->mirror_num). The fix replaces the crash condition by skipping repair when the failing mirror is the device-replace target.
Likely exposure
Exposure is likely limited to Linux systems using Btrfs with device replacement active, especially where the replacement target has unread or not-yet-copied ranges. Non-Btrfs systems are not implicated by the provided sources.
Exploitation context
The bundle does not cite active exploitation, and KEV is false. The known trigger is operational: Btrfs device replacement plus read or checksum failure on the replacement target. Evidence supports denial-of-service risk through kernel BUG, not remote code execution.
Researcher notes
The CVE data lacks CVSS, CWE, and detailed distro package ranges. The affected-version metadata is simplified, so validate against upstream commits and vendor backports. The root cause is assertion misuse around dev-replace mirror remapping.
Mitigation direction
Update to a vendor kernel containing the referenced Btrfs stable fixes.
Check distribution advisories for backported fixes before relying on upstream version numbers.
Avoid risky Btrfs device-replace operations on unpatched systems where practical.
Ensure recent backups before replacing unreliable disks on affected Btrfs hosts.
Validation and detection
Identify Linux hosts using Btrfs filesystems and device replacement workflows.
Record running kernel versions and compare them with vendor fixed-package guidance.
Review kernel logs for Btrfs checksum failures and device-replace activity.
Confirm patched kernels include the upstream commits referenced for this CVE.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2023-54180 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
0CVSS vectors
3Timeline events
0ADP providers
4Source links
Vulnerability timeline
Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.
CVE reservedCVE Program
The CVE ID was reserved by the assigning CNA.
CVE publishedCVE Program
The CVE record was published.
Dec 30, 2025, 12:08 UTC (UTC+00:00)
CVE updatedCVE Program
The CVE record metadata indicates this as the latest update time.