lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aTOv8GxTcWRR39y7@emerald>
Date: Sat, 6 Dec 2025 13:24:16 +0900
From: William Breathitt Gray <wbg@...nel.org>
To: Haotian Zhang <vulab@...as.ac.cn>
Cc: andriy.shevchenko@...ux.intel.com, linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] counter: 104-quad-8: Fix incorrect return value in IRQ
 handler

On Tue, Dec 02, 2025 at 04:39:52PM +0800, Haotian Zhang wrote:
> quad8_irq_handler() should return irqreturn_t enum values, but it
> directly returns negative errno codes from regmap operations on error.
> 
> Return IRQ_NONE instead of raw errno codes on regmap operation failures.
> 
> Fixes: 98ffe0252911 ("counter: 104-quad-8: Migrate to the regmap API")
> Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
> ---
>  drivers/counter/104-quad-8.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c
> index ce81fc4e1ae7..17f4da6c24af 100644
> --- a/drivers/counter/104-quad-8.c
> +++ b/drivers/counter/104-quad-8.c
> @@ -1201,7 +1201,7 @@ static irqreturn_t quad8_irq_handler(int irq, void *private)
> 
>  	ret = regmap_read(priv->map, QUAD8_INTERRUPT_STATUS, &status);
>  	if (ret)
> -		return ret;
> +		return IRQ_NONE;
>  	if (!status)
>  		return IRQ_NONE;
> 
> @@ -1233,7 +1233,7 @@ static irqreturn_t quad8_irq_handler(int irq, void *private)
> 
>  	ret = regmap_write(priv->map, QUAD8_CHANNEL_OPERATION, CLEAR_PENDING_INTERRUPTS);
>  	if (ret)
> -		return ret;
> +		return IRQ_NONE;
> 
>  	return IRQ_HANDLED;
>  }

Hello Haotian,

You are correct, we should return a value of irqreturn_t and not raw
errno codes. However, it would be nice to indicate to users why the IRQ
was left unserviced before return IRQ_NONE. Is there a way to indicate
the regmap_read failure, perhaps via WARN_ONCE() or similar? Is
regmap_read actually capable of failing in this context, or should we
just remove the conditional check entirely?

William Breathitt Gray

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ