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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>

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@xxxxxxxxx>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux