mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
iio: buffer: Fix demux update
commit19ef7b70ca
upstream. When updating the buffer demux, we will skip a scan element from the device in the case `in_ind != out_ind` and we enter the while loop. in_ind should only be refreshed with `find_next_bit()` in the end of the loop. Note, to cause problems we need a situation where we are skippig over an element (channel not enabled) that happens to not have the same size as the next element. Whilst this is a possible situation we haven't actually identified any cases in mainline where it happens as most drivers have consistent channel storage sizes with the exception of the timestamp which is the last element and hence never skipped over. Fixes:5ada4ea9be
("staging:iio: add demux optionally to path from device to buffer") Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20201112144323.28887-1-nuno.sa@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
adf1611a92
commit
894d77998d
1 changed files with 3 additions and 3 deletions
|
@ -850,12 +850,12 @@ static int iio_buffer_update_demux(struct iio_dev *indio_dev,
|
||||||
indio_dev->masklength,
|
indio_dev->masklength,
|
||||||
in_ind + 1);
|
in_ind + 1);
|
||||||
while (in_ind != out_ind) {
|
while (in_ind != out_ind) {
|
||||||
in_ind = find_next_bit(indio_dev->active_scan_mask,
|
|
||||||
indio_dev->masklength,
|
|
||||||
in_ind + 1);
|
|
||||||
length = iio_storage_bytes_for_si(indio_dev, in_ind);
|
length = iio_storage_bytes_for_si(indio_dev, in_ind);
|
||||||
/* Make sure we are aligned */
|
/* Make sure we are aligned */
|
||||||
in_loc = roundup(in_loc, length) + length;
|
in_loc = roundup(in_loc, length) + length;
|
||||||
|
in_ind = find_next_bit(indio_dev->active_scan_mask,
|
||||||
|
indio_dev->masklength,
|
||||||
|
in_ind + 1);
|
||||||
}
|
}
|
||||||
length = iio_storage_bytes_for_si(indio_dev, in_ind);
|
length = iio_storage_bytes_for_si(indio_dev, in_ind);
|
||||||
out_loc = roundup(out_loc, length);
|
out_loc = roundup(out_loc, length);
|
||||||
|
|
Loading…
Reference in a new issue