CVE-2026-143437: thermal/drivers/sprd: validate the sensor id from the device tree
In the Linux kernel, the following vulnerability has been resolved:
thermal/drivers/sprd: validate the sensor id from the device tree
sprdthmprobe() reads each sensor child node's "reg" property into sen->id and uses it without validation: to compute the sensor's register offsets in sprdthmsensorinit(), as the thermal zone id, and finally as an index into thm->sensor[], which has SPRDTHMMAXSENSOR (8) entries:
ret = ofpropertyreadu32(senchild, "reg", &sen->id); ... thm->sensor[sen->id] = sen;
Only the number of sensor nodes is checked against SPRDTHMMAXSENSOR. A "reg" value of 8 or more, or one that is negative once stored in the int sen->id, makes the register offsets point outside the sensor range and the final store land outside thm->sensor[], overwriting the fields that follow it in struct sprdthermaldata or other memory.
Reject an out-of-range id right after reading it, before it is used.
This does not address sparse ids, such as a single sensor with id 7: they leave holes in thm->sensor[] that the later loops over 0..nrsensors-1 dereference. That needs a separate fix.
Found by static analysis tool CodeQL.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In sprd_thm_probe(), reject an out-of-range sensor id immediately after reading the device-tree "reg" property, before using it for register offsets, the thermal zone id, or indexing thm->sensor[].
Event History
Frequently Asked Questions
What systems are exposed to this issue?
Systems using the Linux kernel Spreadtrum thermal driver are exposed when their device tree contains sensor child nodes with an invalid "reg" sensor ID. The affected path uses that ID for register-offset calculation and as an index into an eight-entry sensor array.
What is required to trigger the memory corruption?
A sensor child node must provide a "reg" value outside the valid sensor range, such as 8 or greater, or a value that becomes negative when stored in the integer sensor ID. The driver must then probe that device-tree configuration.
What can be done if the fix cannot be applied immediately?
Ensure every sensor child node's "reg" property is a valid in-range sensor ID for the driver's eight-entry sensor array. Also avoid sparse sensor IDs: although not addressed by this fix, a configuration such as only sensor ID 7 can leave holes that later driver loops dereference.
How can I check whether a device-tree configuration is affected?
Inspect the Spreadtrum thermal sensor child nodes and review their "reg" values. Values of 8 or higher, or values that become negative after storage in the driver's integer sensor ID, are affected; sparse IDs can also cause a separate null-dereference issue.