All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] thermal/drivers/thermal_hwmon: Fix a kernel NULL pointer dereference
@ 2023-03-29  9:00 Zhang Rui
  2023-03-29  9:57 ` Daniel Lezcano
  2023-03-29 16:00 ` Daniel Lezcano
  0 siblings, 2 replies; 17+ messages in thread
From: Zhang Rui @ 2023-03-29  9:00 UTC (permalink / raw)
  To: linux-pm, rafael.j.wysocki, daniel.lezcano; +Cc: linux-kernel

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@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-03-29 18:39 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29  9:00 [PATCH -next] thermal/drivers/thermal_hwmon: Fix a kernel NULL pointer dereference Zhang Rui
2023-03-29  9:57 ` Daniel Lezcano
2023-03-29 10:55   ` Rafael J. Wysocki
2023-03-29 11:24   ` Zhang, Rui
2023-03-29 12:01     ` Rafael J. Wysocki
2023-03-29 12:06   ` Rafael J. Wysocki
2023-03-29 12:33     ` Zhang, Rui
2023-03-29 13:50       ` Rafael J. Wysocki
2023-03-29 14:16     ` Daniel Lezcano
2023-03-29 14:38       ` Rafael J. Wysocki
2023-03-29 15:59         ` Daniel Lezcano
2023-03-29 16:03           ` Rafael J. Wysocki
2023-03-29 16:18             ` Daniel Lezcano
2023-03-29 17:43               ` Rafael J. Wysocki
2023-03-29 18:39                 ` Daniel Lezcano
2023-03-29 16:00 ` Daniel Lezcano
2023-03-29 17:05   ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.