diff options
author | Peter Meerwald <pmeerw@pmeerw.net> | 2015-06-21 23:50:21 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-07-05 15:22:33 +0200 |
commit | 8d05abfaeff52bdf66aba3a3a337dcdbdb4911bf (patch) | |
tree | 3fec769bd0171702b4dfd794ecda1d397fe41ed1 /drivers | |
parent | iio: sx9500: Add missing init in sx9500_buffer_pre{en,dis}able() (diff) | |
download | linux-8d05abfaeff52bdf66aba3a3a337dcdbdb4911bf.tar.xz linux-8d05abfaeff52bdf66aba3a3a337dcdbdb4911bf.zip |
iio: tmp006: Check channel info on write
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/iio/temperature/tmp006.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c index fcc49f89b946..8f21f32f9739 100644 --- a/drivers/iio/temperature/tmp006.c +++ b/drivers/iio/temperature/tmp006.c @@ -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])) { |