Skip to content

Commit

Permalink
iio: tmp006: Check channel info on write
Browse files Browse the repository at this point in the history
only SAMP_FREQ is writable

Will lead to SAMP_FREQ being written by any attempt to write
to the other exported attributes and hence a rather unexpected
result!

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Peter Meerwald authored and Jonathan Cameron committed Jul 19, 2015
1 parent 06b00f9 commit f451957
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/iio/temperature/tmp006.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ static int tmp006_write_raw(struct iio_dev *indio_dev,
struct tmp006_data *data = iio_priv(indio_dev);
int i;

if (mask != IIO_CHAN_INFO_SAMP_FREQ)
return -EINVAL;

for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++)
if ((val == tmp006_freqs[i][0]) &&
(val2 == tmp006_freqs[i][1])) {
Expand Down

0 comments on commit f451957

Please sign in to comment.