CVE-2025-40246

Source
https://cve.org/CVERecord?id=CVE-2025-40246
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40246.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2025-40246
Downstream
Published
2025-12-04T16:08:09.751Z
Modified
2026-03-10T21:52:39.381986Z
Summary
xfs: fix out of bounds memory read error in symlink repair
Details

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): memcpyorig+0x54/0x110 xrepsymlinksalvageinline+0xb3/0xf0 [xfs] xrepsymlinksalvage+0x100/0x110 [xfs] xrepsymlink+0x2e/0x80 [xfs] xrepattempt+0x61/0x1f0 [xfs] xfsscrubmetadata+0x34f/0x5c0 [xfs] xfsiocscrubvmetadata+0x387/0x560 [xfs] xfsfile_ioctl+0xe23/0x10e0 [xfs] __x64sysioctl+0x76/0xc0 dosyscall64+0x4e/0x1e0 entrySYSCALL64afterhwframe+0x4b/0x53

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

allocated by task 3470 on cpu 1 at 263329.131592s (192823.508886s ago): xfsinitlocalfork+0x79/0xe0 [xfs] xfsiformatlocal+0xa4/0x170 [xfs] xfsiformatdatafork+0x148/0x180 [xfs] xfsinodefromdisk+0x2cd/0x480 [xfs] xfsiget+0x450/0xd60 [xfs] xfsbulkstatoneint+0x6b/0x510 [xfs] xfsbulkstatiwalk+0x1e/0x30 [xfs] xfsiwalkagrecs+0xdf/0x150 [xfs] xfsiwalkruncallbacks+0xb9/0x190 [xfs] xfsiwalkag+0x1dc/0x2f0 [xfs] xfsiwalkargs.constprop.0+0x6a/0x120 [xfs] xfsiwalk+0xa4/0xd0 [xfs] xfsbulkstat+0xfa/0x170 [xfs] xfsiocfsbulkstat.isra.0+0x13a/0x230 [xfs] xfsfile_ioctl+0xbf2/0x10e0 [xfs] __x64sysioctl+0x76/0xc0 dosyscall64+0x4e/0x1e0 entrySYSCALL64afterhwframe+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. xfsifork::ifbytes is the size of the xfsifork::ifdata 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.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40246.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
2651923d8d8db00a57665822f017fa7c76758044
Fixed
7c2d68e091584149fe89bcbaf9b99b3162d46ee7
Fixed
81a8685cac4bf081c93a7df591644f4f80240bb9
Fixed
678e1cc2f482e0985a0613ab4a5bf89c497e5acc

Affected versions

v6.*
v6.10
v6.10-rc1
v6.10-rc2
v6.10-rc3
v6.10-rc4
v6.10-rc5
v6.10-rc6
v6.10-rc7
v6.11
v6.11-rc1
v6.11-rc2
v6.11-rc3
v6.11-rc4
v6.11-rc5
v6.11-rc6
v6.11-rc7
v6.12
v6.12-rc1
v6.12-rc2
v6.12-rc3
v6.12-rc4
v6.12-rc5
v6.12-rc6
v6.12-rc7
v6.12.1
v6.12.10
v6.12.11
v6.12.12
v6.12.13
v6.12.14
v6.12.15
v6.12.16
v6.12.17
v6.12.18
v6.12.19
v6.12.2
v6.12.20
v6.12.21
v6.12.22
v6.12.23
v6.12.24
v6.12.25
v6.12.26
v6.12.27
v6.12.28
v6.12.29
v6.12.3
v6.12.30
v6.12.31
v6.12.32
v6.12.33
v6.12.34
v6.12.35
v6.12.36
v6.12.37
v6.12.38
v6.12.39
v6.12.4
v6.12.40
v6.12.41
v6.12.42
v6.12.43
v6.12.44
v6.12.45
v6.12.46
v6.12.47
v6.12.48
v6.12.49
v6.12.5
v6.12.50
v6.12.51
v6.12.52
v6.12.53
v6.12.54
v6.12.55
v6.12.56
v6.12.57
v6.12.58
v6.12.59
v6.12.6
v6.12.7
v6.12.8
v6.12.9
v6.13
v6.13-rc1
v6.13-rc2
v6.13-rc3
v6.13-rc4
v6.13-rc5
v6.13-rc6
v6.13-rc7
v6.14
v6.14-rc1
v6.14-rc2
v6.14-rc3
v6.14-rc4
v6.14-rc5
v6.14-rc6
v6.14-rc7
v6.15
v6.15-rc1
v6.15-rc2
v6.15-rc3
v6.15-rc4
v6.15-rc5
v6.15-rc6
v6.15-rc7
v6.16
v6.16-rc1
v6.16-rc2
v6.16-rc3
v6.16-rc4
v6.16-rc5
v6.16-rc6
v6.16-rc7
v6.17
v6.17-rc1
v6.17-rc2
v6.17-rc3
v6.17-rc4
v6.17-rc5
v6.17-rc6
v6.17-rc7
v6.17.1
v6.17.2
v6.17.3
v6.17.4
v6.17.5
v6.17.6
v6.17.7
v6.17.8
v6.17.9
v6.18-rc1
v6.18-rc2
v6.9
v6.9-rc5
v6.9-rc6
v6.9-rc7

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40246.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.10.0
Fixed
6.12.60
Type
ECOSYSTEM
Events
Introduced
6.13.0
Fixed
6.17.10

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40246.json"