# CVE-2023-54180: btrfs: handle case when repair happens with dev-replace

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **EPSS:** 0.26% (percentile 10, 2026-11-26)
- **Published:** 2025-12-30T12:08:51.727Z
- **Modified:** 2026-06-17T06:46:57.090Z

## Who should check

- Anyone running Linux \>= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, \< a7018b40b49c37fb55736499f790ec0d2b381ae4; \>= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, \< 53e9d6851b56626885476a2966194ba994f8bb4b; \>= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, \< d73a27b86fc722c28a26ec64002e3a7dc86d1c07
- Anyone running Linux 3.8

## Description

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.

## Affected and fixed versions

- Linux: \>= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, \< a7018b40b49c37fb55736499f790ec0d2b381ae4; \>= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, \< 53e9d6851b56626885476a2966194ba994f8bb4b; \>= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, \< d73a27b86fc722c28a26ec64002e3a7dc86d1c07 (cvelist)
- Linux: 3.8 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2023-54180. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-54180.md
Affected: Linux >= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, < a7018b40b49c37fb55736499f790ec0d2b381ae4; >= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, < 53e9d6851b56626885476a2966194ba994f8bb4b; >= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, < d73a27b86fc722c28a26ec64002e3a7dc86d1c07; Linux 3.8
Fixed in: Linux 53e9d6851b56626885476a2966194ba994f8bb4b

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2023-54180 being exploited?

There is no confirmed exploitation: CVE-2023-54180 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.26% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2023-54180?

It has no CVSS score yet. Unknown.

### Which versions are affected by CVE-2023-54180?

Linux \>= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, \< a7018b40b49c37fb55736499f790ec0d2b381ae4; \>= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, \< 53e9d6851b56626885476a2966194ba994f8bb4b; \>= ad6d620e2a5704f6bf3a39c92a75aad962c51cb3, \< d73a27b86fc722c28a26ec64002e3a7dc86d1c07; Linux 3.8.

### Is there a fix for CVE-2023-54180?

Yes. Fixed in Linux 53e9d6851b56626885476a2966194ba994f8bb4b. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2023-54180?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- other: <https://git.kernel.org/stable/c/a7018b40b49c37fb55736499f790ec0d2b381ae4>
- other: <https://git.kernel.org/stable/c/53e9d6851b56626885476a2966194ba994f8bb4b>
- other: <https://git.kernel.org/stable/c/d73a27b86fc722c28a26ec64002e3a7dc86d1c07>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-54180>

HTML: <https://flawdb.com/CVE-2023-54180> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-54180>
