aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChenyuan Yang <[email protected]>2025-03-13 04:36:11 +0000
committerRafael J. Wysocki <[email protected]>2025-03-13 20:45:33 +0000
commit2542a3f70e563a9e70e7ded314286535a3321bdb (patch)
treef15cfcb56da2b9aefa339bfae61adc4fb6029775
parentLinux 6.14-rc6 (diff)
downloadkernel-2542a3f70e563a9e70e7ded314286535a3321bdb.tar.gz
kernel-2542a3f70e563a9e70e7ded314286535a3321bdb.zip
thermal: int340x: Add NULL check for adev
Not all devices have an ACPI companion fwnode, so adev might be NULL. This is similar to the commit cd2fd6eab480 ("platform/x86: int3472: Check for adev == NULL"). Add a check for adev not being set and return -ENODEV in that case to avoid a possible NULL pointer deref in int3402_thermal_probe(). Note, under the same directory, int3400_thermal_probe() has such a check. Fixes: 77e337c6e23e ("Thermal: introduce INT3402 thermal driver") Signed-off-by: Chenyuan Yang <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Subject edit, added Fixes: ] Signed-off-by: Rafael J. Wysocki <[email protected]>
-rw-r--r--drivers/thermal/intel/int340x_thermal/int3402_thermal.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
index 543b03960e99..57b90005888a 100644
--- a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
@@ -45,6 +45,9 @@ static int int3402_thermal_probe(struct platform_device *pdev)
struct int3402_thermal_data *d;
int ret;
+ if (!adev)
+ return -ENODEV;
+
if (!acpi_has_method(adev->handle, "_TMP"))
return -ENODEV;