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: <20240425-vastly-salad-e56b9225e662@spud>
Date: Thu, 25 Apr 2024 16:36:19 +0100
From: Conor Dooley <conor@...nel.org>
To: Conor Dooley <conor.dooley@...rochip.com>
Cc: marius.cristea@...rochip.com, jic23@...nel.org, lars@...afoo.de,
	lgirdwood@...il.com, broonie@...nel.org, linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org, conor+dt@...nel.org
Subject: Re: [PATCH v1] iio: adc: PAC1934: fix accessing out of bounds array
 index

On Thu, Apr 25, 2024 at 01:22:45PM +0100, Conor Dooley wrote:
> On Thu, Apr 25, 2024 at 02:42:32PM +0300, marius.cristea@...rochip.com wrote:
> > From: Marius Cristea <marius.cristea@...rochip.com>
> > 
> > Fix accessing out of bounds array index for average
> > current and voltage measurements. The device itself has
> > only 4 channels, but in sysfs there are "fake"
> > channels for the average voltages and currents too.
> > 
> > Fixes: 0fb528c8255b: "iio: adc: adding support for PAC193x"
> > Reported-by: Conor Dooley <conor.dooley@...rochip.com>
> > Signed-off-by: Marius Cristea <marius.cristea@...rochip.com>


Huh, this is an empty message. I intended to send some tags, but must
not have saved the buffer.

Closes: https://lore.kernel.org/linux-iio/20240405-embellish-bonnet-ab5f10560d93@wendy/
Tested-by: Conor Dooley <conor.dooley@...rochip.com>

Cheers,
Conor.

> > ---
> >  drivers/iio/adc/pac1934.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/iio/adc/pac1934.c b/drivers/iio/adc/pac1934.c
> > index f751260605e4..456f12faa348 100644
> > --- a/drivers/iio/adc/pac1934.c
> > +++ b/drivers/iio/adc/pac1934.c
> > @@ -787,6 +787,15 @@ static int pac1934_read_raw(struct iio_dev *indio_dev,
> >  	s64 curr_energy;
> >  	int ret, channel = chan->channel - 1;
> >  
> > +	/*
> > +	 * For AVG the index should be between 5 to 8.
> > +	 * To calculate PAC1934_CH_VOLTAGE_AVERAGE,
> > +	 * respectively PAC1934_CH_CURRENT real index, we need
> > +	 * to remove the added offset (PAC1934_MAX_NUM_CHANNELS).
> > +	 */
> > +	if (channel >= PAC1934_MAX_NUM_CHANNELS)
> > +		channel = channel - PAC1934_MAX_NUM_CHANNELS;
> > +
> >  	ret = pac1934_retrieve_data(info, PAC1934_MIN_UPDATE_WAIT_TIME_US);
> >  	if (ret < 0)
> >  		return ret;
> > 
> > base-commit: b80ad8e3cd2712b78b98804d1f59199680d8ed91
> > -- 
> > 2.34.1
> > 



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