# CVE-2025-38221: ext4: fix out of bounds punch offset

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

- **Severity:** HIGH 7.1
- **CVSS:** 7.1 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; 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.27% (percentile 12, 2026-11-26)
- **CWE:** CWE-125
- **Published:** 2025-07-04T13:37:37.248Z
- **Modified:** 2026-06-17T09:16:25.047Z

## Who should check

- Anyone running Linux \>= 33f61ecabb10098b63dad3b729552779379f900d, \< a4d60ba277ecd8a98c5a593cbc0ef2237c20a541; \>= 982bf37da09d078570650b691d9084f43805a5de, \< 28b62cb58fd014338f5004170f2e3a35bf0af238; \>= 982bf37da09d078570650b691d9084f43805a5de, \< b5e58bcd79625423487fa3ecba8e8411b5396327
- Anyone running Linux 6.15

## Description

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

ext4: fix out of bounds punch offset

Punching a hole with a start offset that exceeds max\_end is not
permitted and will result in a negative length in the
truncate\_inode\_partial\_folio() function while truncating the page cache,
potentially leading to undesirable consequences.

A simple reproducer:

  truncate -s 9895604649994 /mnt/foo
  xfs\_io -c "pwrite 8796093022208 4096" /mnt/foo
  xfs\_io -c "fpunch 8796093022213 25769803777" /mnt/foo

  kernel BUG at include/linux/highmem.h:275!
  Oops: invalid opcode: 0000 \[\#1\] SMP PTI
  CPU: 3 UID: 0 PID: 710 Comm: xfs\_io Not tainted 6.15.0-rc3
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-2.fc40 04/01/2014
  RIP: 0010:zero\_user\_segments.constprop.0+0xd7/0x110
  RSP: 0018:ffffc90001cf3b38 EFLAGS: 00010287
  RAX: 0000000000000005 RBX: ffffea0001485e40 RCX: 0000000000001000
  RDX: 000000000040b000 RSI: 0000000000000005 RDI: 000000000040b000
  RBP: 000000000040affb R08: ffff888000000000 R09: ffffea0000000000
  R10: 0000000000000003 R11: 00000000fffc7fc5 R12: 0000000000000005
  R13: 000000000040affb R14: ffffea0001485e40 R15: ffff888031cd3000
  FS:  00007f4f63d0b780(0000) GS:ffff8880d337d000(0000)
  knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 000000001ae0b038 CR3: 00000000536aa000 CR4: 00000000000006f0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  Call Trace:
   \<TASK\>
   truncate\_inode\_partial\_folio+0x3dd/0x620
   truncate\_inode\_pages\_range+0x226/0x720
   ? bdev\_getblk+0x52/0x3e0
   ? ext4\_get\_group\_desc+0x78/0x150
   ? crc32c\_arch+0xfd/0x180
   ? \_\_ext4\_get\_inode\_loc+0x18c/0x840
   ? ext4\_inode\_csum+0x117/0x160
   ? jbd2\_journal\_dirty\_metadata+0x61/0x390
   ? \_\_ext4\_handle\_dirty\_metadata+0xa0/0x2b0
   ? kmem\_cache\_free+0x90/0x5a0
   ? jbd2\_journal\_stop+0x1d5/0x550
   ? \_\_ext4\_journal\_stop+0x49/0x100
   truncate\_pagecache\_range+0x50/0x80
   ext4\_truncate\_page\_cache\_block\_range+0x57/0x3a0
   ext4\_punch\_hole+0x1fe/0x670
   ext4\_fallocate+0x792/0x17d0
   ? \_\_count\_memcg\_events+0x175/0x2a0
   vfs\_fallocate+0x121/0x560
   ksys\_fallocate+0x51/0xc0
   \_\_x64\_sys\_fallocate+0x24/0x40
   x64\_sys\_call+0x18d2/0x4170
   do\_syscall\_64+0xa7/0x220
   entry\_SYSCALL\_64\_after\_hwframe+0x76/0x7e

Fix this by filtering out cases where the punching start offset exceeds
max\_end.

## Affected and fixed versions

- Linux: \>= 33f61ecabb10098b63dad3b729552779379f900d, \< a4d60ba277ecd8a98c5a593cbc0ef2237c20a541; \>= 982bf37da09d078570650b691d9084f43805a5de, \< 28b62cb58fd014338f5004170f2e3a35bf0af238; \>= 982bf37da09d078570650b691d9084f43805a5de, \< b5e58bcd79625423487fa3ecba8e8411b5396327 (cvelist)
- Linux: 6.15 (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-2025-38221. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-38221.md
Affected: Linux >= 33f61ecabb10098b63dad3b729552779379f900d, < a4d60ba277ecd8a98c5a593cbc0ef2237c20a541; >= 982bf37da09d078570650b691d9084f43805a5de, < 28b62cb58fd014338f5004170f2e3a35bf0af238; >= 982bf37da09d078570650b691d9084f43805a5de, < b5e58bcd79625423487fa3ecba8e8411b5396327; Linux 6.15
Fixed in: Linux 28b62cb58fd014338f5004170f2e3a35bf0af238

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-2025-38221 being exploited?

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

### How serious is CVE-2025-38221?

High: CVSS 7.1 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2025-38221?

Linux \>= 33f61ecabb10098b63dad3b729552779379f900d, \< a4d60ba277ecd8a98c5a593cbc0ef2237c20a541; \>= 982bf37da09d078570650b691d9084f43805a5de, \< 28b62cb58fd014338f5004170f2e3a35bf0af238; \>= 982bf37da09d078570650b691d9084f43805a5de, \< b5e58bcd79625423487fa3ecba8e8411b5396327; Linux 6.15.

### Is there a fix for CVE-2025-38221?

Yes. Fixed in Linux 28b62cb58fd014338f5004170f2e3a35bf0af238. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2025-38221?

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/a4d60ba277ecd8a98c5a593cbc0ef2237c20a541>
- patch: <https://git.kernel.org/stable/c/28b62cb58fd014338f5004170f2e3a35bf0af238>
- patch: <https://git.kernel.org/stable/c/b5e58bcd79625423487fa3ecba8e8411b5396327>

## 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-2025-38221>

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