Commit 4eb7c2f3 authored by Zhang Rui's avatar Zhang Rui Committed by Rafael J. Wysocki
Browse files

thermal: thermal_hwmon: Fix a kernel NULL pointer dereference



When the hwmon device node of a thermal zone device is not found,
using hwmon->device causes a kernel NULL pointer dereference.

Fixes: dec07d39 ("thermal: Don't use 'device' internal thermal zone structure field")
Reported-by: default avatarPreble Adam C <adam.c.preble@intel.com>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 85b52122
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
	hwmon = thermal_hwmon_lookup_by_type(tz);
	if (unlikely(!hwmon)) {
		/* Should never happen... */
		dev_dbg(hwmon->device, "hwmon device lookup failed!\n");
		dev_dbg(&tz->device, "hwmon device lookup failed!\n");
		return;
	}