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] [thread-next>] [day] [month] [year] [list]
Message-ID: <561655d4b3bd063cb6ee339294ab9c62a5b06d53.camel@gmail.com>
Date: Tue, 22 Oct 2024 16:23:17 +0200
From: Nuno Sá <noname.nuno@...il.com>
To: Zicheng Qu <quzicheng@...wei.com>, lars@...afoo.de, 
	Michael.Hennerich@...log.com, jic23@...nel.org,
 alexandru.tachici@...log.com, 	linux-iio@...r.kernel.org,
 linux-kernel@...r.kernel.org
Cc: tanghui20@...wei.com, zhangqiao22@...wei.com, judy.chenhui@...wei.com
Subject: Re: [PATCH] drivers/iio/adc/ad7124.c: fix division by zero in
 ad7124_set_channel_odr()

On Tue, 2024-10-22 at 13:43 +0000, Zicheng Qu wrote:
> In the ad7124_write_raw() function, parameter val can potentially
> be zero. This may lead to a division by zero when DIV_ROUND_CLOSEST()
> is called within ad7124_set_channel_odr(). The ad7124_write_raw()
> function is invoked through the sequence: iio_write_channel_raw() ->
> iio_write_channel_attribute() -> iio_channel_write(), with no checks
> in place to ensure val is non-zero.
> 
> Cc: stable@...r.kernel.org
> Fixes: 7b8d045e497a ("iio: adc: ad7124: allow more than 8 channels")
> Signed-off-by: Zicheng Qu <quzicheng@...wei.com>
> ---

LGTM,

Reviewed-by: Nuno Sa <nuno.sa@...log.com>

>  drivers/iio/adc/ad7124.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c
> index a5d91933f505..b79c48d46ccc 100644
> --- a/drivers/iio/adc/ad7124.c
> +++ b/drivers/iio/adc/ad7124.c
> @@ -637,7 +637,7 @@ static int ad7124_write_raw(struct iio_dev *indio_dev,
>  
>  	switch (info) {
>  	case IIO_CHAN_INFO_SAMP_FREQ:
> -		if (val2 != 0) {
> +		if (val2 != 0 || val == 0) {
>  			ret = -EINVAL;
>  			break;
>  		}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ