CVE-2026-99716: hwmon: (coretemp) Set nr_cores only after core_data allocation succeeds
In the Linux kernel, the following vulnerability has been resolved:
hwmon: (coretemp) Set nrcores only after coredata allocation succeeds
In inittempdata(), pdata->nrcores is populated from topologynumcoresperpackage() before allocating pdata->coredata. If that allocation fails, inittempdata() returns NULL with pdata->coredata still NULL and pdata->nrcores set to a positive value.
coretempaddcore() logs the error without failing coretempcpuonline(), so the CPU still comes online with pdata->hwmondev registered. When the CPU is later taken offline (or the module is unloaded), coretempcpuoffline() calls gettempdata(pd, cpu), which loops up to pdata->nrcores and dereferences the NULL pdata->coredata pointer.
Store the core count in a local variable and assign pdata->nrcores only after pdata->coredata is allocated, preserving the invariant that pdata->nrcores is zero whenever pdata->coredata is NULL.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.5 - Compensating control
In init_temp_data(), store topology_num_cores_per_package() in a local variable and assign pdata->nr_cores only after pdata->core_data allocation succeeds, so pdata->nr_cores remains zero if the allocation fails.
Frequently Asked Questions
Under what conditions can this issue be triggered?
The issue requires allocation of the coretemp driver's core_data array to fail during CPU online handling. The affected CPU can still be brought online despite that failure, and a later CPU-offline event or unloading the coretemp module triggers the NULL-pointer dereference.
What systems are realistically exposed?
Systems using the Linux kernel coretemp hardware-monitoring driver are exposed when its initialization encounters the described allocation failure. The failure path is specifically relevant to systems that support CPU online/offline operations or where the coretemp module may be unloaded after the failed initialization.
What is the effect of a failed allocation before the fix?
The driver can retain a positive core count while its core-data pointer remains NULL. During subsequent cleanup, it iterates using that count and dereferences the NULL pointer, which can cause a kernel crash.
What is the relevant mitigation if the fix cannot be applied immediately?
Avoid the sequence that follows a failed coretemp initialization with CPU offlining or coretemp module unloading. The supplied data does not provide a configuration-based workaround that prevents the allocation failure itself.