summaryrefslogtreecommitdiff
path: root/scripts/const_structs.checkpatch
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2026-10-31 03:08:08 +0000
committerGuenter Roeck <linux@roeck-us.net>2026-11-02 07:00:05 -0800
commit0f9c7ed3b5009a037e5533eac03a0d4d45ecf1f0 (patch)
treec711d79cca1cda7c18ff74f6f3749cc5cebf4284 /scripts/const_structs.checkpatch
parentf324179e6ccd05dfdc8e98fba2e9d50aea8e7ea2 (diff)
hwmon: (coretemp) Check for NULL platform device in hotplug callbacks
coretemp_get_pdev() returns NULL when topology_logical_die_id(cpu) is negative (such as -ENODEV or -ERANGE from topology_get_logical_id() on a firmware/hardware APIC ID mismatch) or exceeds max_zones (for example, under asymmetric or anomalous ACPI die topologies where topology_max_packages() * topology_max_dies_per_package() is smaller than the logical die count). Commit 6d03bbff456b ("hwmon: (coretemp) Simplify platform device handling") pre-allocated zone_devices[0 .. max_zones - 1] during module init and dropped the NULL checks on pdev in coretemp_cpu_online() and coretemp_cpu_offline(), passing pdev unconditionally to platform_get_drvdata(). When coretemp_get_pdev() returns NULL, platform_get_drvdata(pdev) dereferences &pdev->dev and triggers a kernel NULL pointer dereference. Check for a NULL pdev and return 0 in both coretemp_cpu_online() and coretemp_cpu_offline() before calling platform_get_drvdata(). Returning 0 in coretemp_cpu_online() ignores the unmapped CPU without blocking CPU bringup or tearing down valid thermal zones on other dies. Reported-by: Sashiko <sashiko-bot@kernel.org> Fixes: 6d03bbff456b ("hwmon: (coretemp) Simplify platform device handling") Cc: stable@vger.kernel.org Tested-by: Asaf Nuri Bertizlioğlu <ycistak@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'scripts/const_structs.checkpatch')
0 files changed, 0 insertions, 0 deletions