Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1312891

[PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify()

From Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Newsgroups linux.kernel
Subject [PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify()
Date 2016-01-20 06:50 +0100
Message-ID <qSTOy-25l-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

It needs to check maximum trip size before using it.
Otherwise, each driver might be called with unsupported trip.

Reported-by: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/thermal/thermal_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 7f7a3ca..9761f49 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -461,6 +461,9 @@ static void thermal_tripped_notify(struct thermal_zone_device *tz,
 		kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, msg);
 	}
 
+	if (tz->trips <= trip + 1)
+		goto unlock;
+
 	ret = tz->ops->get_trip_temp(tz, trip + 1, &upper_trip_temp);
 	if (ret)
 		goto unlock;
-- 
1.9.1

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify() Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> - 2016-01-20 06:50 +0100
  Re: [PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-01-20 08:10 +0100

csiph-web