From 6b101116ae445311031f3e9f91d3010d444b9845 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Mon, 16 Jan 2012 22:51:47 +0100 Subject: 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>. Reported-by: Jean Delvare Signed-off-by: Guenter Roeck Signed-off-by: Jean Delvare --- drivers/hwmon/lm90.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index bdfd675488a..d2dd5f90496 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -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; -- cgit v1.2.3