Linux IIO development
 help / color / mirror / Atom feed
From: Francesco Dolcini <francesco@dolcini.it>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "João Paulo Gonçalves" <jpaulo.silvagoncalves@gmail.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"João Paulo Gonçalves" <joao.goncalves@toradex.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Matti Vaittinen" <mazziesaccount@gmail.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] iio: trigger: Fix condition for own trigger
Date: Sun, 16 Jun 2024 11:38:54 +0200	[thread overview]
Message-ID: <Zm6yrnDwSye85Hl1@livingston.pivistrello.it> (raw)
In-Reply-To: <20240615115018.2b73d6b3@jic23-huawei>

On Sat, Jun 15, 2024 at 11:50:18AM +0100, Jonathan Cameron wrote:
> On Fri, 14 Jun 2024 11:36:58 -0300
> João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com> wrote:
> 
> > From: João Paulo Gonçalves <joao.goncalves@toradex.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@vger.kernel.org
> > Fixes: 517985ebc531 ("iio: trigger: Add simple trigger_validation helper")
> > Signed-off-by: João Paulo Gonçalves <joao.goncalves@toradex.com>

Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.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).

This was noticed while me and Joao were working on the ads1119 driver you
have been recently reviewing. We wanted to use iio_trigger_using_own()
and it was not behaving the right way. We looked into it and found the bug.

Given that I do not know the exact impact on the drivers that are using this
function.

> 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.

All the users of iio_trigger_using_own() are older than the commit that
introduced the bug, it is safe to assume that they need the fix and
are expecting the function to behave the same way is documented and it was
before the bug was introduced.

The broken commit is not that old and less than 10 IIO drivers are using this
function. Given that I think that is not that odd that it took 1 year to find
the bug.

Francesco


  reply	other threads:[~2024-06-16  9:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 14:36 [PATCH] iio: trigger: Fix condition for own trigger João Paulo Gonçalves
2024-06-15 10:50 ` Jonathan Cameron
2024-06-16  9:38   ` Francesco Dolcini [this message]
2024-06-17 20:09     ` Jonathan Cameron
2024-06-17  6:13 ` Matti Vaittinen

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=Zm6yrnDwSye85Hl1@livingston.pivistrello.it \
    --to=francesco@dolcini.it \
    --cc=jic23@kernel.org \
    --cc=joao.goncalves@toradex.com \
    --cc=jpaulo.silvagoncalves@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=stable@vger.kernel.org \
    /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