[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230329090055.7537-1-rui.zhang@intel.com>
Date: Wed, 29 Mar 2023 17:00:55 +0800
From: Zhang Rui <rui.zhang@...el.com>
To: linux-pm@...r.kernel.org, rafael.j.wysocki@...el.com,
daniel.lezcano@...aro.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH -next] thermal/drivers/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.
Reported-by: Preble Adam C <adam.c.preble@...el.com>
Signed-off-by: Zhang Rui <rui.zhang@...el.com>
---
Fixes: dec07d399cc8 ("thermal: Don't use 'device' internal thermal zone structure field")
dec07d399cc8 is a commit in the linux-next branch of linux-pm repo.
I'm not sure if the Fix tag applies to such commit or not.
---
drivers/thermal/thermal_hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index c59db17dddd6..261743f461be 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -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;
}
--
2.25.1
Powered by blists - more mailing lists