# CVE-2025-38050: mm/hugetlb: fix kernel NULL pointer dereference when replacing free hugetlb folios

> 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, NVD) `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.27% (percentile 13, 2026-11-28)
- **CWE:** CWE-476
- **Published:** 2025-06-18T09:33:32.022Z
- **Modified:** 2026-11-17T11:17:23.973Z

## Who should check

- Anyone running Linux \>= 94e63a6c43f3a7fa4253a67247e2956f64daa3c6, \< 64e40bc15cacbe2e59e0f9140978d94d68e72738; \>= 04f13d241b8b146b23038bffd907cb8278391d07, \< e97283978a9848190d451f7038ac399613445f79; \>= 04f13d241b8b146b23038bffd907cb8278391d07, \< 113ed54ad276c352ee5ce109bdcf0df118a43bda
- Anyone running Linux 6.14

## Description

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

mm/hugetlb: fix kernel NULL pointer dereference when replacing free hugetlb folios

A kernel crash was observed when replacing free hugetlb folios:

BUG: kernel NULL pointer dereference, address: 0000000000000028
PGD 0 P4D 0
Oops: Oops: 0000 \[\#1\] SMP NOPTI
CPU: 28 UID: 0 PID: 29639 Comm: test\_cma.sh Tainted 6.15.0-rc6-zp \#41 PREEMPT(voluntary)
RIP: 0010:alloc\_and\_dissolve\_hugetlb\_folio+0x1d/0x1f0
RSP: 0018:ffffc9000b30fa90 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000342cca RCX: ffffea0043000000
RDX: ffffc9000b30fb08 RSI: ffffea0043000000 RDI: 0000000000000000
RBP: ffffc9000b30fb20 R08: 0000000000001000 R09: 0000000000000000
R10: ffff88886f92eb00 R11: 0000000000000000 R12: ffffea0043000000
R13: 0000000000000000 R14: 00000000010c0200 R15: 0000000000000004
FS:  00007fcda5f14740(0000) GS:ffff8888ec1d8000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000028 CR3: 0000000391402000 CR4: 0000000000350ef0
Call Trace:
\<TASK\>
 replace\_free\_hugepage\_folios+0xb6/0x100
 alloc\_contig\_range\_noprof+0x18a/0x590
 ? srso\_return\_thunk+0x5/0x5f
 ? down\_read+0x12/0xa0
 ? srso\_return\_thunk+0x5/0x5f
 cma\_range\_alloc.constprop.0+0x131/0x290
 \_\_cma\_alloc+0xcf/0x2c0
 cma\_alloc\_write+0x43/0xb0
 simple\_attr\_write\_xsigned.constprop.0.isra.0+0xb2/0x110
 debugfs\_attr\_write+0x46/0x70
 full\_proxy\_write+0x62/0xa0
 vfs\_write+0xf8/0x420
 ? srso\_return\_thunk+0x5/0x5f
 ? filp\_flush+0x86/0xa0
 ? srso\_return\_thunk+0x5/0x5f
 ? filp\_close+0x1f/0x30
 ? srso\_return\_thunk+0x5/0x5f
 ? do\_dup2+0xaf/0x160
 ? srso\_return\_thunk+0x5/0x5f
 ksys\_write+0x65/0xe0
 do\_syscall\_64+0x64/0x170
 entry\_SYSCALL\_64\_after\_hwframe+0x76/0x7e

There is a potential race between \_\_update\_and\_free\_hugetlb\_folio() and
replace\_free\_hugepage\_folios():

CPU1                              CPU2
\_\_update\_and\_free\_hugetlb\_folio   replace\_free\_hugepage\_folios
                                    folio\_test\_hugetlb(folio)
                                    -- It's still hugetlb folio.

  \_\_folio\_clear\_hugetlb(folio)
  hugetlb\_free\_folio(folio)
                                    h = folio\_hstate(folio)
                                    -- Here, h is NULL pointer

When the above race condition occurs, folio\_hstate(folio) returns NULL,
and subsequent access to this NULL pointer will cause the system to crash.
To resolve this issue, execute folio\_hstate(folio) under the protection
of the hugetlb\_lock lock, ensuring that folio\_hstate(folio) does not
return NULL.

## Affected and fixed versions

- Linux: \>= 94e63a6c43f3a7fa4253a67247e2956f64daa3c6, \< 64e40bc15cacbe2e59e0f9140978d94d68e72738; \>= 04f13d241b8b146b23038bffd907cb8278391d07, \< e97283978a9848190d451f7038ac399613445f79; \>= 04f13d241b8b146b23038bffd907cb8278391d07, \< 113ed54ad276c352ee5ce109bdcf0df118a43bda (cvelist)
- Linux: 6.14 (cvelist)

## Mitigation

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

Details: https://flawdb.com/CVE-2025-38050.md
Affected: Linux >= 94e63a6c43f3a7fa4253a67247e2956f64daa3c6, < 64e40bc15cacbe2e59e0f9140978d94d68e72738; >= 04f13d241b8b146b23038bffd907cb8278391d07, < e97283978a9848190d451f7038ac399613445f79; >= 04f13d241b8b146b23038bffd907cb8278391d07, < 113ed54ad276c352ee5ce109bdcf0df118a43bda; Linux 6.14
Fixed in: Linux 64e40bc15cacbe2e59e0f9140978d94d68e72738, Linux 113ed54ad276c352ee5ce109bdcf0df118a43bda

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

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

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

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

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

Linux \>= 94e63a6c43f3a7fa4253a67247e2956f64daa3c6, \< 64e40bc15cacbe2e59e0f9140978d94d68e72738; \>= 04f13d241b8b146b23038bffd907cb8278391d07, \< e97283978a9848190d451f7038ac399613445f79; \>= 04f13d241b8b146b23038bffd907cb8278391d07, \< 113ed54ad276c352ee5ce109bdcf0df118a43bda; Linux 6.14.

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

Yes. Fixed in Linux 64e40bc15cacbe2e59e0f9140978d94d68e72738, Linux 113ed54ad276c352ee5ce109bdcf0df118a43bda. Upgrade Linux to 113ed54ad276c352ee5ce109bdcf0df118a43bda or later.

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

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/e97283978a9848190d451f7038ac399613445f79>
- patch: <https://git.kernel.org/stable/c/113ed54ad276c352ee5ce109bdcf0df118a43bda>
- other: <https://git.kernel.org/stable/c/64e40bc15cacbe2e59e0f9140978d94d68e72738>

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

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