All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: proximity: aw96103: Fix early return in IRQ handler loop
@ 2026-08-19 21:08 Salah Triki
  2026-08-20  1:46 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Salah Triki @ 2026-08-19 21:08 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
  Cc: linux-iio, linux-kernel, Salah Triki

When an unrecognized proximity status is encountered in aw96103_irq(),
the default case executes a return IRQ_HANDLED. Because this happens
inside the loop over the device's channels, any remaining channels are
left unhandled, causing missed events and stale IRQ status.

Replace the return IRQ_HANDLED statement in the default case with
continue to ensure all channels are processed even if one has an
unexpected status value.

Fixes: 07b241262dca ("iio: proximity: aw96103: Add support for aw96103/aw96105 proximity sensor")
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/iio/proximity/aw96103.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/aw96103.c b/drivers/iio/proximity/aw96103.c
index 8fbb755dcae0..b1f36a51d56f 100644
--- a/drivers/iio/proximity/aw96103.c
+++ b/drivers/iio/proximity/aw96103.c
@@ -669,7 +669,7 @@ static irqreturn_t aw96103_irq(int irq, void *data)
 				       iio_get_time_ns(indio_dev));
 			break;
 		default:
-			return IRQ_HANDLED;
+			continue;
 		}
 		aw96103->channels_arr[i].old_irq_status = curr_status;
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: proximity: aw96103: Fix early return in IRQ handler loop
  2026-08-19 21:08 [PATCH] iio: proximity: aw96103: Fix early return in IRQ handler loop Salah Triki
@ 2026-08-20  1:46 ` Jonathan Cameron
  2026-08-20  1:49   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2026-08-20  1:46 UTC (permalink / raw)
  To: Salah Triki
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
	linux-kernel

On Wed, 19 Aug 2026 22:08:26 +0100
Salah Triki <salah.triki@gmail.com> wrote:

> When an unrecognized proximity status is encountered in aw96103_irq(),
> the default case executes a return IRQ_HANDLED. Because this happens
> inside the loop over the device's channels, any remaining channels are
> left unhandled, causing missed events and stale IRQ status.
> 
> Replace the return IRQ_HANDLED statement in the default case with
> continue to ensure all channels are processed even if one has an
> unexpected status value.
> 
> Fixes: 07b241262dca ("iio: proximity: aw96103: Add support for aw96103/aw96105 proximity sensor")
Hi Salah,

Interesting little find.

So usual question for a fix: Have you seen this in the wild, or is
it code reading / tool found?  I'm not against changing it but it
is useful to know this for attaching different levels of importance
to the bug and hence how fast we merge it. Please add a note on that
to the commit message for v2 (though let it sit for a while for others
to look at)

Is there a path for this to happen short of corruption / broken / 
malicious device?  If not, no fixes tag - it's hardening or a useabilty
improvement rather than a bug fix

Thanks

Jonathan

> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>  drivers/iio/proximity/aw96103.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/proximity/aw96103.c b/drivers/iio/proximity/aw96103.c
> index 8fbb755dcae0..b1f36a51d56f 100644
> --- a/drivers/iio/proximity/aw96103.c
> +++ b/drivers/iio/proximity/aw96103.c
> @@ -669,7 +669,7 @@ static irqreturn_t aw96103_irq(int irq, void *data)
>  				       iio_get_time_ns(indio_dev));
>  			break;
>  		default:
> -			return IRQ_HANDLED;
> +			continue;
>  		}
>  		aw96103->channels_arr[i].old_irq_status = curr_status;
>  	}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: proximity: aw96103: Fix early return in IRQ handler loop
  2026-08-20  1:46 ` Jonathan Cameron
@ 2026-08-20  1:49   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2026-08-20  1:49 UTC (permalink / raw)
  To: Salah Triki
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
	linux-kernel, Wang Shuaijie

On Thu, 20 Aug 2026 02:46:53 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Wed, 19 Aug 2026 22:08:26 +0100
> Salah Triki <salah.triki@gmail.com> wrote:
> 
> > When an unrecognized proximity status is encountered in aw96103_irq(),
> > the default case executes a return IRQ_HANDLED. Because this happens
> > inside the loop over the device's channels, any remaining channels are
> > left unhandled, causing missed events and stale IRQ status.
> > 
> > Replace the return IRQ_HANDLED statement in the default case with
> > continue to ensure all channels are processed even if one has an
> > unexpected status value.
> > 
> > Fixes: 07b241262dca ("iio: proximity: aw96103: Add support for aw96103/aw96105 proximity sensor")  
> Hi Salah,
> 
> Interesting little find.
> 
> So usual question for a fix: Have you seen this in the wild, or is
> it code reading / tool found?  I'm not against changing it but it
> is useful to know this for attaching different levels of importance
> to the bug and hence how fast we merge it. Please add a note on that
> to the commit message for v2 (though let it sit for a while for others
> to look at)
> 
> Is there a path for this to happen short of corruption / broken / 
> malicious device?  If not, no fixes tag - it's hardening or a useabilty
> improvement rather than a bug fix

+CC Wang Shuaijie who wrote this one and may be able to provide
more insight into why it previously exited on this condition.

Jonathan

> 
> Thanks
> 
> Jonathan
> 
> > Signed-off-by: Salah Triki <salah.triki@gmail.com>
> > ---
> >  drivers/iio/proximity/aw96103.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/proximity/aw96103.c b/drivers/iio/proximity/aw96103.c
> > index 8fbb755dcae0..b1f36a51d56f 100644
> > --- a/drivers/iio/proximity/aw96103.c
> > +++ b/drivers/iio/proximity/aw96103.c
> > @@ -669,7 +669,7 @@ static irqreturn_t aw96103_irq(int irq, void *data)
> >  				       iio_get_time_ns(indio_dev));
> >  			break;
> >  		default:
> > -			return IRQ_HANDLED;
> > +			continue;
> >  		}
> >  		aw96103->channels_arr[i].old_irq_status = curr_status;
> >  	}  
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-20  1:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 21:08 [PATCH] iio: proximity: aw96103: Fix early return in IRQ handler loop Salah Triki
2026-08-20  1:46 ` Jonathan Cameron
2026-08-20  1:49   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.