thermal: add sanity check for the passive attribute
[pandora-kernel.git] / drivers / thermal / thermal_sys.c
index 6f8d8f9..310e40a 100644 (file)
@@ -225,6 +225,12 @@ passive_store(struct device *dev, struct device_attribute *attr,
        if (!sscanf(buf, "%d\n", &state))
                return -EINVAL;
 
+       /* sanity check: values below 1000 millicelcius don't make sense
+        * and can cause the system to go into a thermal heart attack
+        */
+       if (state && state < 1000)
+               return -EINVAL;
+
        if (state && !tz->forced_passive) {
                mutex_lock(&thermal_list_lock);
                list_for_each_entry(cdev, &thermal_cdev_list, node) {