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, 6 Oct 2019 10:56:05 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Bartosz Golaszewski <brgl@...ev.pl>
Cc:     Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH 2/4] iio: pressure: bmp280: use
 devm_iio_device_register()

On Wed,  2 Oct 2019 10:57:57 +0200
Bartosz Golaszewski <brgl@...ev.pl> wrote:

> From: Bartosz Golaszewski <bgolaszewski@...libre.com>
> 
> We can use the managed variant of iio_device_register() and remove
> the corresponding unregister operation from the remove callback.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>

This results in a race where the regulators are powered down before
we remove the userspace interfaces.  All sorts of fun can therefore
occur...

If we fix that with some devm_add_action_or_reset fun then there
is still the fact that we loose the 'obviously correct' property
of the remove being a mirror of the probe because the ordering
wrt to runtime_pm is different.  

So I'd leave this one alone.

Thanks,

Jonathan


> ---
>  drivers/iio/pressure/bmp280-core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> index c21f8ce7b09c..f22400e1e98f 100644
> --- a/drivers/iio/pressure/bmp280-core.c
> +++ b/drivers/iio/pressure/bmp280-core.c
> @@ -1127,7 +1127,7 @@ int bmp280_common_probe(struct device *dev,
>  	pm_runtime_use_autosuspend(dev);
>  	pm_runtime_put(dev);
>  
> -	ret = iio_device_register(indio_dev);
> +	ret = devm_iio_device_register(dev, indio_dev);
>  	if (ret)
>  		goto out_runtime_pm_disable;
>  
> @@ -1149,7 +1149,6 @@ int bmp280_common_remove(struct device *dev)
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct bmp280_data *data = iio_priv(indio_dev);
>  
> -	iio_device_unregister(indio_dev);
>  	pm_runtime_get_sync(data->dev);
>  	pm_runtime_put_noidle(data->dev);
>  	pm_runtime_disable(data->dev);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ