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

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
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment