From: Jonathan Cameron <jic23@kernel.org>
To: Silvano Seva <s.seva@4sigma.it>
Cc: a.greco@4sigma.it, Lorenzo Bianconi <lorenzo@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] iio: imu: st_lsm6dsx: fix possible lockup in st_lsm6dsx_read_fifo
Date: Sat, 15 Mar 2025 18:36:44 +0000 [thread overview]
Message-ID: <20250315183644.04fd688b@jic23-huawei> (raw)
In-Reply-To: <20250311085030.3593-2-s.seva@4sigma.it>
On Tue, 11 Mar 2025 09:49:47 +0100
Silvano Seva <s.seva@4sigma.it> wrote:
> Prevent st_lsm6dsx_read_fifo from falling in an infinite loop in case
> pattern_len is equal to zero and the device FIFO is not empty.
>
> Fixes: 290a6ce11d93 ("iio: imu: add support to lsm6dsx driver")
> Signed-off-by: Silvano Seva <s.seva@4sigma.it>
I think you could validly have kept Lorenzo's ack given this was
just breaking the patch into two parts. I put it back and applied
these with them marked for stable to the fixes-togreg branch of iio.git
Thanks,
Jonathan
> ---
>
> Changes since v1:
> * st_lsm6dsx_read_fifo: moved check for zero pattern_len before fifo_len assignment
> * st_lsm6dsx_read_fifo: dropped check for zero fifo_len
> * added Fixes tags in commit message
>
> Changes since v2:
> * split patch in two parts, one fixing st_lsm6dsx_read_fifo and one fixing
> st_lsm6dsx_read_tagged_fifo
>
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> index 0a7cd8c1aa33..480a9b31065c 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> @@ -392,6 +392,9 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw)
> if (fifo_status & cpu_to_le16(ST_LSM6DSX_FIFO_EMPTY_MASK))
> return 0;
>
> + if (!pattern_len)
> + pattern_len = ST_LSM6DSX_SAMPLE_SIZE;
> +
> fifo_len = (le16_to_cpu(fifo_status) & fifo_diff_mask) *
> ST_LSM6DSX_CHAN_SIZE;
> fifo_len = (fifo_len / pattern_len) * pattern_len;
next prev parent reply other threads:[~2025-03-15 18:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 8:49 [PATCH v3 1/2] iio: imu: st_lsm6dsx: fix possible lockup in st_lsm6dsx_read_fifo Silvano Seva
2025-03-11 8:49 ` [PATCH v3 2/2] iio: imu: st_lsm6dsx: fix possible lockup in st_lsm6dsx_read_tagged_fifo Silvano Seva
2025-03-15 18:36 ` Jonathan Cameron [this message]
2025-03-17 9:02 ` [PATCH v3 1/2] iio: imu: st_lsm6dsx: fix possible lockup in st_lsm6dsx_read_fifo Silvano Seva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250315183644.04fd688b@jic23-huawei \
--to=jic23@kernel.org \
--cc=a.greco@4sigma.it \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=s.seva@4sigma.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox