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: <022dcd26-801b-5a5e-ee75-45791d9c5986@kernel.org>
Date:   Wed, 26 Apr 2017 06:37:13 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Shrirang Bagul <shrirang.bagul@...onical.com>
Cc:     linux-iio@...r.kernel.org, linus.walleij@...aro.org,
        lorenzo.bianconi83@...il.com, gregor.boirie@...rot.com,
        rob@...nel.org, linux-kernel@...r.kernel.org,
        m.niestroj@...nn-global.com
Subject: Re: [PATCH] iio: st_pressure: st_accel: Initialise sensor platform
 data properly

On 19/04/17 15:05, Shrirang Bagul wrote:
> This patch fixes the sensor platform data initialisation for st_pressure
> and st_accel device drivers. Without this patch, the driver fails to
> register the sensors when the user removes and re-loads the driver.
> 
> 1. Unload the kernel modules for st_pressure
> $ sudo rmmod st_pressure_i2c
> $ sudo rmmod st_pressure
> 
> 2. Re-load the driver
> $ sudo insmod st_pressure
> $ sudo insmod st_pressure_i2c
> --- OR ---
> $ sudo modprobe st_pressure_i2c
> 
> dmesg errors:
> 
> [ 160.935707] iio iio:device2: DRDY on pdata not valid.
> [ 160.941505] st-press-i2c: probe of i2c-SMO9210:00 failed with error -22
> 
> The driver fails to register the pressure sensor device. Devices
> supported by st_accel driver also suffer from the same bug.
> 
> Signed-off-by: Shrirang Bagul <shrirang.bagul@...onical.com>
Unless I am missing something, the severity of this bug is fairly minor
so whilst I'm pleased to have it fixed, I'm not intending to mark this
for stable.

If anyone has a cunning way of exploiting it then let me know!

Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/iio/accel/st_accel_core.c       | 7 ++++---
>  drivers/iio/pressure/st_pressure_core.c | 8 ++++----
>  2 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
> index 784670e2736b..07d1489cd457 100644
> --- a/drivers/iio/accel/st_accel_core.c
> +++ b/drivers/iio/accel/st_accel_core.c
> @@ -710,6 +710,8 @@ static const struct iio_trigger_ops st_accel_trigger_ops = {
>  int st_accel_common_probe(struct iio_dev *indio_dev)
>  {
>  	struct st_sensor_data *adata = iio_priv(indio_dev);
> +	struct st_sensors_platform_data *pdata =
> +		(struct st_sensors_platform_data *)adata->dev->platform_data;
>  	int irq = adata->get_irq_data_ready(indio_dev);
>  	int err;
>  
> @@ -736,9 +738,8 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
>  					&adata->sensor_settings->fs.fs_avl[0];
>  	adata->odr = adata->sensor_settings->odr.odr_avl[0].hz;
>  
> -	if (!adata->dev->platform_data)
> -		adata->dev->platform_data =
> -			(struct st_sensors_platform_data *)&default_accel_pdata;
> +	if (!pdata)
> +		pdata = (struct st_sensors_platform_data *)&default_accel_pdata;
>  
>  	err = st_sensors_init_sensor(indio_dev, adata->dev->platform_data);
>  	if (err < 0)
> diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
> index 5f2680855552..0d8d5665769a 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -567,6 +567,8 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
>  int st_press_common_probe(struct iio_dev *indio_dev)
>  {
>  	struct st_sensor_data *press_data = iio_priv(indio_dev);
> +	struct st_sensors_platform_data *pdata =
> +		(struct st_sensors_platform_data *)press_data->dev->platform_data;
>  	int irq = press_data->get_irq_data_ready(indio_dev);
>  	int err;
>  
> @@ -602,10 +604,8 @@ int st_press_common_probe(struct iio_dev *indio_dev)
>  	press_data->odr = press_data->sensor_settings->odr.odr_avl[0].hz;
>  
>  	/* Some devices don't support a data ready pin. */
> -	if (!press_data->dev->platform_data &&
> -				press_data->sensor_settings->drdy_irq.addr)
> -		press_data->dev->platform_data =
> -			(struct st_sensors_platform_data *)&default_press_pdata;
> +	if (!pdata && press_data->sensor_settings->drdy_irq.addr)
> +		pdata =	(struct st_sensors_platform_data *)&default_press_pdata;
>  
>  	err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data);
>  	if (err < 0)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ