Skip to contentSkip to conversation

hwmon: (lm90) Add range check to set_update_interval

PATCH Applied Guenter Roeck 2 participants 2 messages Jan 12, 2012

Subsystems (2)
lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/1 hwmon: (lm90) Add range check to set_update_interval

When writing the update_interval attribute, the parameter value was not range checked, which could cause an integer overflow and result in an arbitrary update interval. Fix by limiting the value range to <0, 100000>.

---
 drivers/hwmon/lm90.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/lm90.c +1 -1
index bdfd675..d2dd5f9 100644
@@ -917,7 +917,7 @@ static ssize_t set_update_interval(struct device *dev,
 		return err;
 
 	mutex_lock(&data->update_lock);
-	lm90_set_convrate(client, data, val);
+	lm90_set_convrate(client, data, SENSORS_LIMIT(val, 0, 100000));
 	mutex_unlock(&data->update_lock);
 
 	return count;
Signature · 7 lines
1.7.5.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Applied
#1 lore raw
Quoted 15 lines · Guenter Roeck

When writing the update_interval attribute, the parameter value was not range checked, which could cause an integer overflow and result in an arbitrary update interval. Fix by limiting the value range to <0, 100000>.

---
 drivers/hwmon/lm90.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/lm90.c +0 -0
index bdfd675..d2dd5f9 100644

drivers/hwmon/lm90.c static ssize_t set_update_interval(struct device *dev, · line 923

Quoted 8 lines
drivers/hwmon/lm90.c +1 -1
@@ -917,7 +917,7 @@ static ssize_t set_update_interval(struct device *dev,
 		return err;
 
 	mutex_lock(&data->update_lock);
-	lm90_set_convrate(client, data, val);
+	lm90_set_convrate(client, data, SENSORS_LIMIT(val, 0, 100000));
 	mutex_unlock(&data->update_lock);
 
 	return count;

Applied, thanks.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors