# CVE-2025-40138: f2fs: fix to avoid NULL pointer dereference in f2fs\_check\_quota\_consistency()

> 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 11, 2026-11-28)
- **Published:** 2025-11-12T10:23:23.912Z
- **Modified:** 2026-10-19T21:10:00.160Z

## Who should check

- Anyone running Linux \>= d185351325237da688de006a2c579e82ea97bdfe, \< 3f3458852bbfe79c60f2412b8b04677b96688b6e; \>= d185351325237da688de006a2c579e82ea97bdfe, \< 930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c
- Anyone running Linux 6.17

## Description

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

f2fs: fix to avoid NULL pointer dereference in f2fs\_check\_quota\_consistency()

syzbot reported a f2fs bug as below:

Oops: gen\[  107.736417\]\[ T5848\] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 \[\#1\] SMP KASAN PTI
KASAN: null-ptr-deref in range \[0x0000000000000000-0x0000000000000007\]
CPU: 1 UID: 0 PID: 5848 Comm: syz-executor263 Tainted: G        W           6.17.0-rc1-syzkaller-00014-g0e39a731820a \#0 PREEMPT\_{RT,(full)}
RIP: 0010:strcmp+0x3c/0xc0 lib/string.c:284
Call Trace:
 \<TASK\>
 f2fs\_check\_quota\_consistency fs/f2fs/super.c:1188 \[inline\]
 f2fs\_check\_opt\_consistency+0x1378/0x2c10 fs/f2fs/super.c:1436
 \_\_f2fs\_remount fs/f2fs/super.c:2653 \[inline\]
 f2fs\_reconfigure+0x482/0x1770 fs/f2fs/super.c:5297
 reconfigure\_super+0x224/0x890 fs/super.c:1077
 do\_remount fs/namespace.c:3314 \[inline\]
 path\_mount+0xd18/0xfe0 fs/namespace.c:4112
 do\_mount fs/namespace.c:4133 \[inline\]
 \_\_do\_sys\_mount fs/namespace.c:4344 \[inline\]
 \_\_se\_sys\_mount+0x317/0x410 fs/namespace.c:4321
 do\_syscall\_x64 arch/x86/entry/syscall\_64.c:63 \[inline\]
 do\_syscall\_64+0xfa/0x3b0 arch/x86/entry/syscall\_64.c:94
 entry\_SYSCALL\_64\_after\_hwframe+0x77/0x7f

The direct reason is f2fs\_check\_quota\_consistency() may suffer null-ptr-deref
issue in strcmp().

The bug can be reproduced w/ below scripts:
mkfs.f2fs -f /dev/vdb
mount -t f2fs -o usrquota /dev/vdb /mnt/f2fs
quotacheck -uc /mnt/f2fs/
umount /mnt/f2fs
mount -t f2fs -o usrjquota=aquota.user,jqfmt=vfsold /dev/vdb /mnt/f2fs
mount -t f2fs -o remount,usrjquota=,jqfmt=vfsold /dev/vdb /mnt/f2fs
umount /mnt/f2fs

So, before old\_qname and new\_qname comparison, we need to check whether
they are all valid pointers, fix it.

## Affected and fixed versions

- Linux: \>= d185351325237da688de006a2c579e82ea97bdfe, \< 3f3458852bbfe79c60f2412b8b04677b96688b6e; \>= d185351325237da688de006a2c579e82ea97bdfe, \< 930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c (cvelist)
- Linux: 6.17 (cvelist)

## Mitigation

- Upgrade Linux to 930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c 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-40138. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-40138.md
Affected: Linux >= d185351325237da688de006a2c579e82ea97bdfe, < 3f3458852bbfe79c60f2412b8b04677b96688b6e; >= d185351325237da688de006a2c579e82ea97bdfe, < 930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c; Linux 6.17
Fixed in: Linux 3f3458852bbfe79c60f2412b8b04677b96688b6e, Linux 930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c

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

There is no confirmed exploitation: CVE-2025-40138 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-28).

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

It has no CVSS score yet. Unknown.

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

Linux \>= d185351325237da688de006a2c579e82ea97bdfe, \< 3f3458852bbfe79c60f2412b8b04677b96688b6e; \>= d185351325237da688de006a2c579e82ea97bdfe, \< 930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c; Linux 6.17.

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

Yes. Fixed in Linux 3f3458852bbfe79c60f2412b8b04677b96688b6e, Linux 930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c. Upgrade Linux to 930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c or later.

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

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/3f3458852bbfe79c60f2412b8b04677b96688b6e>
- other: <https://git.kernel.org/stable/c/930a9a6ee8e7ffa20af4bffbfc2bbd21d83bf81c>

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

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