[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <877fj44xk5.wl%kuninori.morimoto.gx@renesas.com>
Date: Wed, 20 Jan 2016 05:45:24 +0000
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
To: Eduardo Valentin <edubezval@...il.com>
CC: Zhang Rui <rui.zhang@...el.com>, Simon <horms@...ge.net.au>,
Magnus <magnus.damm@...il.com>,
Linux-Kernel <linux-kernel@...r.kernel.org>,
<linux-renesas-soc@...r.kernel.org>
Subject: [PATCH] thermal: core: don't call unsupported trip on thermal_tripped_notify()
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.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@...il.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@...esas.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
Powered by blists - more mailing lists