KernelScan.io

HIGH Introduced in 6.4

mtd OtpNvmem DoubleFree

CVE-2026-98834

CVSS 7.8 / 10.0 KernelScan AI

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

01

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.

02

Engine v0.9.0

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.

Affecteddrivers/mtd/mtdcore.c (mtd core)

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.

03

BranchIntroducedFixed inPatch commit
5.155.15.1115.16cecf007418b9
6.16.1.286.226300879cd8e
6.26.2.156.3—
6.36.3.26.4—
7.26.47.2.10—
mainline6.47.3—

04

State of the newest release of each Civil Infrastructure Platform SLTS tree, from CIP's own fix records.

CIP treeState
cip/6.12Affected — no CIP fix yet (latest 6.12.118-cip136)
cip/6.1Affected — no CIP fix yet (latest 6.1.190-cip62)
cip/6.1-rtAffected — no CIP fix yet (latest 6.1.189-cip61-rt32)