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]
Date:   Sun, 15 Dec 2019 15:52:03 +0000
From:   Jonathan Cameron <jic23@...23.retrosnub.co.uk>
To:     Sasha Levin <sashal@...nel.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Alexandru Ardelean <alexandru.ardelean@...log.com>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        linux-iio@...r.kernel.org
Subject: Re: [PATCH AUTOSEL 5.4 019/350] iio: tcs3414: fix
 iio_triggered_buffer_{pre,post}enable positions

On Tue, 10 Dec 2019 15:58:31 -0500
Sasha Levin <sashal@...nel.org> wrote:

> From: Alexandru Ardelean <alexandru.ardelean@...log.com>
> 
> [ Upstream commit 0fe2f2b789190661df24bb8bf62294145729a1fe ]
> 
> The iio_triggered_buffer_{predisable,postenable} functions attach/detach
> the poll functions.
> 
> For the predisable hook, the disable code should occur before detaching
> the poll func, and for the postenable hook, the poll func should be
> attached before the enable code.
> 
> The driver was slightly reworked. The preenable hook was moved to the
> postenable, to add some symmetry to the postenable/predisable part.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
I doubt this did any harm, but wouldn't consider it stable material normally.

This is part of a general rework going on to allow some core refactoring.

I should have added a note to this one like some related patches that it
is a logical fix, but we don't have an actual known bug afaik.

Sorry about that.

Jonathan

> ---
>  drivers/iio/light/tcs3414.c | 30 ++++++++++++++++++++----------
>  1 file changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c
> index 7c0291c5fe76e..b542e5619ead8 100644
> --- a/drivers/iio/light/tcs3414.c
> +++ b/drivers/iio/light/tcs3414.c
> @@ -240,32 +240,42 @@ static const struct iio_info tcs3414_info = {
>  	.attrs = &tcs3414_attribute_group,
>  };
>  
> -static int tcs3414_buffer_preenable(struct iio_dev *indio_dev)
> +static int tcs3414_buffer_postenable(struct iio_dev *indio_dev)
>  {
>  	struct tcs3414_data *data = iio_priv(indio_dev);
> +	int ret;
> +
> +	ret = iio_triggered_buffer_postenable(indio_dev);
> +	if (ret)
> +		return ret;
>  
>  	data->control |= TCS3414_CONTROL_ADC_EN;
> -	return i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL,
> +	ret = i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL,
>  		data->control);
> +	if (ret)
> +		iio_triggered_buffer_predisable(indio_dev);
> +
> +	return ret;
>  }
>  
>  static int tcs3414_buffer_predisable(struct iio_dev *indio_dev)
>  {
>  	struct tcs3414_data *data = iio_priv(indio_dev);
> -	int ret;
> -
> -	ret = iio_triggered_buffer_predisable(indio_dev);
> -	if (ret < 0)
> -		return ret;
> +	int ret, ret2;
>  
>  	data->control &= ~TCS3414_CONTROL_ADC_EN;
> -	return i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL,
> +	ret = i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL,
>  		data->control);
> +
> +	ret2 = iio_triggered_buffer_predisable(indio_dev);
> +	if (!ret)
> +		ret = ret2;
> +
> +	return ret;
>  }
>  
>  static const struct iio_buffer_setup_ops tcs3414_buffer_setup_ops = {
> -	.preenable = tcs3414_buffer_preenable,
> -	.postenable = &iio_triggered_buffer_postenable,
> +	.postenable = tcs3414_buffer_postenable,
>  	.predisable = tcs3414_buffer_predisable,
>  };
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ