Skip to content

Commit

Permalink
hwmon: (lm90) Add range check to set_update_interval
Browse files Browse the repository at this point in the history
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 <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
  • Loading branch information
Guenter Roeck authored and Jean Delvare committed Jan 16, 2012
1 parent 2fe28ab commit 6b10111
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hwmon/lm90.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6b10111

Please sign in to comment.