# CVE-2025-40246: xfs: fix out of bounds memory read error in symlink repair

> 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.27% (percentile 13, 2026-11-26)
- **Published:** 2025-12-04T16:08:09.751Z
- **Modified:** 2026-10-19T19:10:00.130Z

## Who should check

- Anyone running Linux \>= 2651923d8d8db00a57665822f017fa7c76758044, \< 7c2d68e091584149fe89bcbaf9b99b3162d46ee7; \>= 2651923d8d8db00a57665822f017fa7c76758044, \< 81a8685cac4bf081c93a7df591644f4f80240bb9; \>= 2651923d8d8db00a57665822f017fa7c76758044, \< 678e1cc2f482e0985a0613ab4a5bf89c497e5acc
- Anyone running Linux 6.10

## Description

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

xfs: fix out of bounds memory read error in symlink repair

xfs/286 produced this report on my test fleet:

 ==================================================================
 BUG: KFENCE: out-of-bounds read in memcpy\_orig+0x54/0x110

 Out-of-bounds read at 0xffff88843fe9e038 (184B right of kfence-\#184):
  memcpy\_orig+0x54/0x110
  xrep\_symlink\_salvage\_inline+0xb3/0xf0 \[xfs\]
  xrep\_symlink\_salvage+0x100/0x110 \[xfs\]
  xrep\_symlink+0x2e/0x80 \[xfs\]
  xrep\_attempt+0x61/0x1f0 \[xfs\]
  xfs\_scrub\_metadata+0x34f/0x5c0 \[xfs\]
  xfs\_ioc\_scrubv\_metadata+0x387/0x560 \[xfs\]
  xfs\_file\_ioctl+0xe23/0x10e0 \[xfs\]
  \_\_x64\_sys\_ioctl+0x76/0xc0
  do\_syscall\_64+0x4e/0x1e0
  entry\_SYSCALL\_64\_after\_hwframe+0x4b/0x53

 kfence-\#184: 0xffff88843fe9df80-0xffff88843fe9dfea, size=107, cache=kmalloc-128

 allocated by task 3470 on cpu 1 at 263329.131592s (192823.508886s ago):
  xfs\_init\_local\_fork+0x79/0xe0 \[xfs\]
  xfs\_iformat\_local+0xa4/0x170 \[xfs\]
  xfs\_iformat\_data\_fork+0x148/0x180 \[xfs\]
  xfs\_inode\_from\_disk+0x2cd/0x480 \[xfs\]
  xfs\_iget+0x450/0xd60 \[xfs\]
  xfs\_bulkstat\_one\_int+0x6b/0x510 \[xfs\]
  xfs\_bulkstat\_iwalk+0x1e/0x30 \[xfs\]
  xfs\_iwalk\_ag\_recs+0xdf/0x150 \[xfs\]
  xfs\_iwalk\_run\_callbacks+0xb9/0x190 \[xfs\]
  xfs\_iwalk\_ag+0x1dc/0x2f0 \[xfs\]
  xfs\_iwalk\_args.constprop.0+0x6a/0x120 \[xfs\]
  xfs\_iwalk+0xa4/0xd0 \[xfs\]
  xfs\_bulkstat+0xfa/0x170 \[xfs\]
  xfs\_ioc\_fsbulkstat.isra.0+0x13a/0x230 \[xfs\]
  xfs\_file\_ioctl+0xbf2/0x10e0 \[xfs\]
  \_\_x64\_sys\_ioctl+0x76/0xc0
  do\_syscall\_64+0x4e/0x1e0
  entry\_SYSCALL\_64\_after\_hwframe+0x4b/0x53

 CPU: 1 UID: 0 PID: 1300113 Comm: xfs\_scrub Not tainted 6.18.0-rc4-djwx \#rc4 PREEMPT(lazy)  3d744dd94e92690f00a04398d2bd8631dcef1954
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-4.module+el8.8.0+21164+ed375313 04/01/2014
 ==================================================================

On further analysis, I realized that the second parameter to min() is
not correct.  xfs\_ifork::if\_bytes is the size of the xfs\_ifork::if\_data
buffer.  if\_bytes can be smaller than the data fork size because:

(a) the forkoff code tries to keep the data area as large as possible
(b) for symbolic links, if\_bytes is the ondisk file size + 1
(c) forkoff is always a multiple of 8.

Case in point: for a single-byte symlink target, forkoff will be
8 but the buffer will only be 2 bytes long.

In other words, the logic here is wrong and we walk off the end of the
incore buffer.  Fix that.

## Affected and fixed versions

- Linux: \>= 2651923d8d8db00a57665822f017fa7c76758044, \< 7c2d68e091584149fe89bcbaf9b99b3162d46ee7; \>= 2651923d8d8db00a57665822f017fa7c76758044, \< 81a8685cac4bf081c93a7df591644f4f80240bb9; \>= 2651923d8d8db00a57665822f017fa7c76758044, \< 678e1cc2f482e0985a0613ab4a5bf89c497e5acc (cvelist)
- Linux: 6.10 (cvelist)

## Mitigation

- Upgrade Linux to 678e1cc2f482e0985a0613ab4a5bf89c497e5acc or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-40246.md
Affected: Linux >= 2651923d8d8db00a57665822f017fa7c76758044, < 7c2d68e091584149fe89bcbaf9b99b3162d46ee7; >= 2651923d8d8db00a57665822f017fa7c76758044, < 81a8685cac4bf081c93a7df591644f4f80240bb9; >= 2651923d8d8db00a57665822f017fa7c76758044, < 678e1cc2f482e0985a0613ab4a5bf89c497e5acc; Linux 6.10
Fixed in: Linux 7c2d68e091584149fe89bcbaf9b99b3162d46ee7, Linux 81a8685cac4bf081c93a7df591644f4f80240bb9, Linux 678e1cc2f482e0985a0613ab4a5bf89c497e5acc

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

There is no confirmed exploitation: CVE-2025-40246 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-40246?

It has no CVSS score yet. Unknown.

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

Linux \>= 2651923d8d8db00a57665822f017fa7c76758044, \< 7c2d68e091584149fe89bcbaf9b99b3162d46ee7; \>= 2651923d8d8db00a57665822f017fa7c76758044, \< 81a8685cac4bf081c93a7df591644f4f80240bb9; \>= 2651923d8d8db00a57665822f017fa7c76758044, \< 678e1cc2f482e0985a0613ab4a5bf89c497e5acc; Linux 6.10.

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

Yes. Fixed in Linux 7c2d68e091584149fe89bcbaf9b99b3162d46ee7, Linux 81a8685cac4bf081c93a7df591644f4f80240bb9, Linux 678e1cc2f482e0985a0613ab4a5bf89c497e5acc. Upgrade Linux to 678e1cc2f482e0985a0613ab4a5bf89c497e5acc or later.

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

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/7c2d68e091584149fe89bcbaf9b99b3162d46ee7>
- other: <https://git.kernel.org/stable/c/81a8685cac4bf081c93a7df591644f4f80240bb9>
- other: <https://git.kernel.org/stable/c/678e1cc2f482e0985a0613ab4a5bf89c497e5acc>

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

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