HIGH Introduced in 6.4
mtd OtpNvmem DoubleFree
CVE-2026-98834
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: mtd: core: avoid double-free of OTP NVMEM device If factory OTP setup fails after the user OTP NVMEM device has been registered, mtd_otp_nvmem_add() unregisters the user device but leaves mtd->otp_user_nvmem set. On an error, the caller unregisters it again. For -EOPNOTSUPP, registration continues and normal teardown unregisters it again. Clear mtd->otp_user_nvmem after unregistering it.
02KernelScan AI Analysis
Risk summary
A double-free vulnerability in the MTD subsystem's OTP NVMEM initialization allows a local attacker who can trigger flash device probing to corrupt kernel memory, potentially achieving privilege escalation or kernel crash. The bug occurs when factory OTP setup fails after the user OTP NVMEM device has been registered — the error path frees the object but leaves a dangling pointer, causing a second free during caller cleanup.
Vulnerability analysis
During MTD device initialization, the OTP NVMEM provider registers a user OTP device then attempts to register a factory OTP device. If the factory registration fails, the error path unregisters the user device but neglects to clear the pointer in the MTD structure. The caller's subsequent cleanup then unregisters the same object a second time, resulting in a double-free of the NVMEM device structure. An attacker with local access who can cause a flash device with failing factory OTP setup to be probed — for example by loading a crafted MTD driver module or inserting malicious hardware — can trigger this condition to corrupt kernel heap metadata and potentially execute arbitrary code.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 5.15 | 5.15.111 | 5.16 | cecf007418b9 |
| 6.1 | 6.1.28 | 6.2 | 26300879cd8e |
| 6.2 | 6.2.15 | 6.3 | — |
| 6.3 | 6.3.2 | 6.4 | — |
| 7.2 | 6.4 | 7.2.10 | — |
| mainline | 6.4 | 7.3 | — |
04CIP Kernels
State of the newest release of each Civil Infrastructure Platform SLTS tree, from CIP's own fix records.
| CIP tree | State |
|---|---|
| cip/6.12 | Affected — no CIP fix yet (latest 6.12.114-cip34) |
| cip/6.1 | Affected — no CIP fix yet (latest 6.1.190-cip62) |
| cip/6.1-rt | Affected — no CIP fix yet (latest 6.1.189-cip61-rt32) |