# CVE-2023-53247: btrfs: set\_page\_extent\_mapped after read\_folio in btrfs\_cont\_expand

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

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.23% (percentile 8, 2026-11-26)
- **CWE:** CWE-617
- **Published:** 2025-09-15T14:46:17.344Z
- **Modified:** 2026-06-17T06:44:37.477Z

## Who should check

- Anyone running Linux \>= 32443de3382be98c0a8b8f6f50d23da2e10c4117, \< 0a5e0bc8e8618e32a6ca64450867628eb0a627bf; \>= 32443de3382be98c0a8b8f6f50d23da2e10c4117, \< a5880e69cf7fe4a0bb1eabae02205352d1b59b7b; \>= 32443de3382be98c0a8b8f6f50d23da2e10c4117, \< 17b17fcd6d446b95904a6929c40012ee7f0afc0c
- Anyone running Linux 5.12

## Description

In the Linux kernel, the following vulnerability has been resolved:

btrfs: set\_page\_extent\_mapped after read\_folio in btrfs\_cont\_expand

While trying to get the subpage blocksize tests running, I hit the
following panic on generic/476

  assertion failed: PagePrivate(page) && page-\>private, in fs/btrfs/subpage.c:229
  kernel BUG at fs/btrfs/subpage.c:229!
  Internal error: Oops - BUG: 00000000f2000800 \[\#1\] SMP
  CPU: 1 PID: 1453 Comm: fsstress Not tainted 6.4.0-rc7+ \#12
  Hardware name: QEMU KVM Virtual Machine, BIOS edk2-20230301gitf80f052277c8-26.fc38 03/01/2023
  pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
  pc : btrfs\_subpage\_assert+0xbc/0xf0
  lr : btrfs\_subpage\_assert+0xbc/0xf0
  Call trace:
   btrfs\_subpage\_assert+0xbc/0xf0
   btrfs\_subpage\_clear\_checked+0x38/0xc0
   btrfs\_page\_clear\_checked+0x48/0x98
   btrfs\_truncate\_block+0x5d0/0x6a8
   btrfs\_cont\_expand+0x5c/0x528
   btrfs\_write\_check.isra.0+0xf8/0x150
   btrfs\_buffered\_write+0xb4/0x760
   btrfs\_do\_write\_iter+0x2f8/0x4b0
   btrfs\_file\_write\_iter+0x1c/0x30
   do\_iter\_readv\_writev+0xc8/0x158
   do\_iter\_write+0x9c/0x210
   vfs\_iter\_write+0x24/0x40
   iter\_file\_splice\_write+0x224/0x390
   direct\_splice\_actor+0x38/0x68
   splice\_direct\_to\_actor+0x12c/0x260
   do\_splice\_direct+0x90/0xe8
   generic\_copy\_file\_range+0x50/0x90
   vfs\_copy\_file\_range+0x29c/0x470
   \_\_arm64\_sys\_copy\_file\_range+0xcc/0x498
   invoke\_syscall.constprop.0+0x80/0xd8
   do\_el0\_svc+0x6c/0x168
   el0\_svc+0x50/0x1b0
   el0t\_64\_sync\_handler+0x114/0x120
   el0t\_64\_sync+0x194/0x198

This happens because during btrfs\_cont\_expand we'll get a page, set it
as mapped, and if it's not Uptodate we'll read it.  However between the
read and re-locking the page we could have called release\_folio() on the
page, but left the page in the file mapping.  release\_folio() can clear
the page private, and thus further down we blow up when we go to modify
the subpage bits.

Fix this by putting the set\_page\_extent\_mapped() after the read.  This
is safe because read\_folio() will call set\_page\_extent\_mapped() before
it does the read, and then if we clear page private but leave it on the
mapping we're completely safe re-setting set\_page\_extent\_mapped().  With
this patch I can now run generic/476 without panicing.

## Affected and fixed versions

- Linux: \>= 32443de3382be98c0a8b8f6f50d23da2e10c4117, \< 0a5e0bc8e8618e32a6ca64450867628eb0a627bf; \>= 32443de3382be98c0a8b8f6f50d23da2e10c4117, \< a5880e69cf7fe4a0bb1eabae02205352d1b59b7b; \>= 32443de3382be98c0a8b8f6f50d23da2e10c4117, \< 17b17fcd6d446b95904a6929c40012ee7f0afc0c (cvelist)
- Linux: 5.12 (cvelist)

## Mitigation

- Upgrade Linux to 17b17fcd6d446b95904a6929c40012ee7f0afc0c or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2023-53247.md
Affected: Linux >= 32443de3382be98c0a8b8f6f50d23da2e10c4117, < 0a5e0bc8e8618e32a6ca64450867628eb0a627bf; >= 32443de3382be98c0a8b8f6f50d23da2e10c4117, < a5880e69cf7fe4a0bb1eabae02205352d1b59b7b; >= 32443de3382be98c0a8b8f6f50d23da2e10c4117, < 17b17fcd6d446b95904a6929c40012ee7f0afc0c; Linux 5.12
Fixed in: Linux 0a5e0bc8e8618e32a6ca64450867628eb0a627bf, Linux 17b17fcd6d446b95904a6929c40012ee7f0afc0c

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-53247 being exploited?

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

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

Medium: CVSS 5.5 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

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

Linux \>= 32443de3382be98c0a8b8f6f50d23da2e10c4117, \< 0a5e0bc8e8618e32a6ca64450867628eb0a627bf; \>= 32443de3382be98c0a8b8f6f50d23da2e10c4117, \< a5880e69cf7fe4a0bb1eabae02205352d1b59b7b; \>= 32443de3382be98c0a8b8f6f50d23da2e10c4117, \< 17b17fcd6d446b95904a6929c40012ee7f0afc0c; Linux 5.12.

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

Yes. Fixed in Linux 0a5e0bc8e8618e32a6ca64450867628eb0a627bf, Linux 17b17fcd6d446b95904a6929c40012ee7f0afc0c. Upgrade Linux to 17b17fcd6d446b95904a6929c40012ee7f0afc0c or later.

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

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

- patch: <https://git.kernel.org/stable/c/0a5e0bc8e8618e32a6ca64450867628eb0a627bf>
- patch: <https://git.kernel.org/stable/c/a5880e69cf7fe4a0bb1eabae02205352d1b59b7b>
- patch: <https://git.kernel.org/stable/c/17b17fcd6d446b95904a6929c40012ee7f0afc0c>

## 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-53247>

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