Skip to content

Commit 8114ef8

Browse files
Silvano Sevajic23
authored andcommitted
iio: imu: st_lsm6dsx: fix possible lockup in st_lsm6dsx_read_tagged_fifo
Prevent st_lsm6dsx_read_tagged_fifo from falling in an infinite loop in case pattern_len is equal to zero and the device FIFO is not empty. Fixes: 801a6e0 ("iio: imu: st_lsm6dsx: add support to LSM6DSO") Signed-off-by: Silvano Seva <s.seva@4sigma.it> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20250311085030.3593-4-s.seva@4sigma.it Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 159ca7f commit 8114ef8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,9 @@ int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw)
626626
if (!fifo_len)
627627
return 0;
628628

629+
if (!pattern_len)
630+
pattern_len = ST_LSM6DSX_TAGGED_SAMPLE_SIZE;
631+
629632
for (read_len = 0; read_len < fifo_len; read_len += pattern_len) {
630633
err = st_lsm6dsx_read_block(hw,
631634
ST_LSM6DSX_REG_FIFO_OUT_TAG_ADDR,

0 commit comments

Comments
 (0)