[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240615115018.2b73d6b3@jic23-huawei>
Date: Sat, 15 Jun 2024 11:50:18 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: João Paulo Gonçalves
<jpaulo.silvagoncalves@...il.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>, João Paulo
Gonçalves <joao.goncalves@...adex.com>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org, Matti Vaittinen
<mazziesaccount@...il.com>, stable@...r.kernel.org
Subject: Re: [PATCH] iio: trigger: Fix condition for own trigger
On Fri, 14 Jun 2024 11:36:58 -0300
João Paulo Gonçalves <jpaulo.silvagoncalves@...il.com> wrote:
> From: João Paulo Gonçalves <joao.goncalves@...adex.com>
>
> The condition for checking if triggers belong to the same IIO device to
> set attached_own_device is currently inverted, causing
> iio_trigger_using_own() to return an incorrect value. Fix it by testing
> for the correct return value of iio_validate_own_trigger().
>
> Cc: stable@...r.kernel.org
> Fixes: 517985ebc531 ("iio: trigger: Add simple trigger_validation helper")
> Signed-off-by: João Paulo Gonçalves <joao.goncalves@...adex.com>
Ouch. Can you give an example of resulting user visible result? That
will help people decide whether to pick this up for their distro kernels
etc. In some cases, looks like we'll get garbage timestamps and in others
may get stale data (or garbage).
Odd no one has noticed this in the past whilst testing those dependent
features in particular drivers and I worry a little that we may have bugs
in the users as a result of iio_trigger_using_own() reporting the inverse
of the intended. I've take a quick look at the users and 'think' they are
ok, but would definitely like a few others to confirm.
Also on a practical basis I just sent a fixes pull request so this one
probably won't go anywhere for a week or so anyway so we have time.
> ---
> drivers/iio/industrialio-trigger.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> index 16de57846bd9..2e84776f4fbd 100644
> --- a/drivers/iio/industrialio-trigger.c
> +++ b/drivers/iio/industrialio-trigger.c
> @@ -315,7 +315,7 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig,
> * this is the case if the IIO device and the trigger device share the
> * same parent device.
> */
> - if (iio_validate_own_trigger(pf->indio_dev, trig))
> + if (!iio_validate_own_trigger(pf->indio_dev, trig))
> trig->attached_own_device = true;
>
> return ret;
> --
> 2.34.1
Powered by blists - more mailing lists