Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1312072lqs; Sat, 15 Jun 2024 03:50:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWUHx1bCgYgNvyIs14k30dDkdHZz3EQyC5eKXrJUJJS2N3HsQNoiZkjcfqxynS7flUrbTbr4KoPWfu07sP4R8fYvT8n70l7t5M7gLu/mg== X-Google-Smtp-Source: AGHT+IEJCrfPR1u5b/WtslIUunLwLd1lULzRAQ1uRLTPhNRvmqDJOyu5Jg0a0YXOuYbSfWaq1Khf X-Received: by 2002:a17:90b:1487:b0:2c1:aff8:f8e with SMTP id 98e67ed59e1d1-2c4db24d0e2mr4596215a91.12.1718448632863; Sat, 15 Jun 2024 03:50:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718448632; cv=pass; d=google.com; s=arc-20160816; b=ZQhF02XisTgnUvlDmro/wY9P8cL0If+05MkLadphlzOrYm0OTkh2eg2O/mwh0J5jnL JL++Q7SeNF34BO344TZl4Lguk0reukEjuULiWSH0pbuaMr6AtRn16cnObpIkyFmIRZez +qzq7a3C87oUeAJx1I0qs0LF2QFCKjNwlCdBDsG8rNleOJ75ZazKQ9cULYGDNYMECyvA 3IXs7Jpuzr/LolKGJoLnR9hCrPGNO4Aln4liQT3kf70+xOXayI0oj+WXkxNyEofGZ+yU 8mWyxnLA3Z8jyRcD/mBjOpTHiiL1P3IDGa0dFivpT9j2eJrD76xfKvL2XU5P7L9aB9Na kTnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=qVpUVrNUXRpAfwCF+C4fCxvgJKK0gAZ+a70TBYKTUcQ=; fh=35NWf8kFOf5B0/KszxICfVc4NrFH5hmCxIZIO6bxPq4=; b=ANcbU7bpvAt/XbUPT8c97tLpHddHC6HvTlytzuEA8+OwCAnPYs0e/8c6Gvo3q1CZhu xWsiHApfI+lxypuU4AaTspD1uuI5UZqgVLxxYYDVBt50shtPSJdS1mweFJwlHvJ3HXm3 S2jGzDT+vVDiQAcmM0tueYW09z+AQsAVPVbqQM3sk6kA0h0KhiCW/QcEHptlRNh1HrcF CAoR5SfhM88GonuE7FdROdrxP7NZ8bxJvUcA6nMha7/H3qUL8LfalWMG+6FDZIZaH9q3 me9aETxzJDnu1FFFbuu8rJ2OqZpKx5UkbLrnaIDWD9I/x5eSdGTzhsswXwUHzUCxyJW+ 6s9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VGxivWwe; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-215840-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4a76e46ccsi7890076a91.128.2024.06.15.03.50.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 03:50:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215840-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VGxivWwe; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-215840-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6F779284589 for ; Sat, 15 Jun 2024 10:50:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCEAA38FB9; Sat, 15 Jun 2024 10:50:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VGxivWwe" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC4AE2E636; Sat, 15 Jun 2024 10:50:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718448625; cv=none; b=UCEvSGTjjteHa8trAeg3X3ib0s/Ej1xRdRwIyT2busFMrR4gALhq9gWfhIx4Nr8r+x0SNAhNR2mIrpViPsWpWcz2pJG0RnQGmtxJlru+ayOKvR768UEA718YkG0si+k+Vw1qO8bEYzJRhYW1qEX9UrdDf/bVpVh346JxZ+JOJxI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718448625; c=relaxed/simple; bh=+3wzKJYFrmmEQ3zH1YhduyYUW+NkzSU9v/arsIC76BA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hcWzuUA3pscF3MkupnW0TlWquxF8ZveJMhL74KdOk/PaJ1w84QaRV+W2SnhJFKLBCnw6OpCZv3GbRxwjl5ZuPSeHNdXKovzBEiA6ZZG+2L62x576UTL9NcNtw/DZZam3Ks46zKVi/FrmVJdvKAl3pW6qH4NQ+Lr2vO22k4x8MXg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VGxivWwe; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43C72C116B1; Sat, 15 Jun 2024 10:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718448624; bh=+3wzKJYFrmmEQ3zH1YhduyYUW+NkzSU9v/arsIC76BA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VGxivWwe0bQfL6J1rl1Jziop7/nqJQ+cdzXwhjOYcutq5GSZH8GvMG4DTo4q+/xZP rjbKrju+3wCbdni6Zo9ZfGS0P06ZUD+9H/PouQKgCc2idnebg19NO0TdwQs6jgv/Tf Irrtupy8Nyq2oVTaP2ABFXSB+M3HHEK31vnUyuJ2O1ahhlIbWIH+dfXWijR3oDHw0v SOAnpYhKi16IaPGcIBjRaTPHJZ3lXhPKir+VCWxuJMWv+R/mPTRQX3sKdxeRLzmQTG /W+5VROMjefkpvMBCmhbYg8hTjD3o9ydtBOmEvFQoyuGwJt5OIkikKTPDE4fqEuDzC 3VquB+1izvFQw== Date: Sat, 15 Jun 2024 11:50:18 +0100 From: Jonathan Cameron To: =?UTF-8?B?Sm/Do28=?= Paulo =?UTF-8?B?R29uw6dhbHZlcw==?= Cc: Lars-Peter Clausen , =?UTF-8?B?Sm/Do28=?= Paulo =?UTF-8?B?R29uw6dhbHZlcw==?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Matti Vaittinen , stable@vger.kernel.org Subject: Re: [PATCH] iio: trigger: Fix condition for own trigger Message-ID: <20240615115018.2b73d6b3@jic23-huawei> In-Reply-To: <20240614143658.3531097-1-jpaulo.silvagoncalves@gmail.com> References: <20240614143658.3531097-1-jpaulo.silvagoncalves@gmail.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 14 Jun 2024 11:36:58 -0300 Jo=C3=A3o Paulo Gon=C3=A7alves wrote: > From: Jo=C3=A3o Paulo Gon=C3=A7alves >=20 > 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(). >=20 > Cc: stable@vger.kernel.org > Fixes: 517985ebc531 ("iio: trigger: Add simple trigger_validation helper") > Signed-off-by: Jo=C3=A3o Paulo Gon=C3=A7alves 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(-) >=20 > diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industriali= o-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 =3D true; >=20 > return ret; > -- > 2.34.1