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: <20230604123256.6cf470bc@jic23-huawei>
Date:   Sun, 4 Jun 2023 12:32:56 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     fl.scratchpad@...il.com
Cc:     Alexandru Tachici <alexandru.tachici@...log.com>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        Alexandru Ardelean <aardelean@...iqon.com>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nuno Sa <nuno.sa@...log.com>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v3 1/5] iio: adc: ad7192: Fix null ad7192_state pointer
 access

On Tue, 30 May 2023 09:53:07 +0200
fl.scratchpad@...il.com wrote:

> From: Fabrizio Lamarque <fl.scratchpad@...il.com>
> 
> Pointer to indio_dev structure is obtained via spi_get_drvdata() at
> the beginning of function ad7192_setup(), but the spi->dev->driver_data
> member is not initialized, hence a NULL pointer is returned.
> 
> Fix by changing ad7192_setup() signature to take pointer to struct
> iio_dev, and get ad7192_state pointer via st = iio_priv(indio_dev);
> 
> Fixes: bd5dcdeb3fd0 ("iio: adc: ad7192: convert to device-managed functions")
> Signed-off-by: Fabrizio Lamarque <fl.scratchpad@...il.com>
> Reviewed-by: Nuno Sa <nuno.sa@...log.com>
I'll pick those of this series up that everyone seems happy with.

Applied to the fixes-togreg branch of iio.git
Thanks,

Jonathan

> ---
>  drivers/iio/adc/ad7192.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index 55a6ab591016..94a9cf34a255 100644
> --- a/drivers/iio/adc/ad7192.c
> +++ b/drivers/iio/adc/ad7192.c
> @@ -380,9 +380,9 @@ static int ad7192_of_clock_select(struct ad7192_state *st)
>  	return clock_sel;
>  }
>  
> -static int ad7192_setup(struct ad7192_state *st, struct device_node *np)
> +static int ad7192_setup(struct iio_dev *indio_dev, struct device_node *np)
>  {
> -	struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
> +	struct ad7192_state *st = iio_priv(indio_dev);
>  	bool rej60_en, refin2_en;
>  	bool buf_en, bipolar, burnout_curr_en;
>  	unsigned long long scale_uv;
> @@ -1073,7 +1073,7 @@ static int ad7192_probe(struct spi_device *spi)
>  		}
>  	}
>  
> -	ret = ad7192_setup(st, spi->dev.of_node);
> +	ret = ad7192_setup(indio_dev, spi->dev.of_node);
>  	if (ret)
>  		return ret;
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ