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:   Fri, 19 Aug 2022 18:12:25 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Matti Vaittinen <mazziesaccount@...il.com>
Cc:     Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
        Marcelo Schmitt <marcelo.schmitt1@...il.com>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: ad7292: Prevent regulator double disable

On Fri, 19 Aug 2022 11:51:07 +0300
Matti Vaittinen <mazziesaccount@...il.com> wrote:

> The ad7292 tries to add an devm_action for disabling a regulator at
> device detach using devm_add_action_or_reset(). The
> devm_add_action_or_reset() does call the release function should adding
> action fail. The driver inspects the value returned by
> devm_add_action_or_reset() and manually calls regulator_disable() if
> adding the action has failed. This leads to double disable and messes
> the enable count for regulator.
> 
> Do not manually call disable if devm_add_action_or_reset() fails.
> 
> Fixes: 506d2e317a0a ("iio: adc: Add driver support for AD7292")
> Signed-off-by: Matti Vaittinen <mazziesaccount@...il.com>
> 
Good spot. Applied to the fixes-togreg branch of iio.git
and marked for stable.

Jonathan

> ---
> 
> The bug was found during browsing the code. I don't have the hardware to
> test this so reviewing and testing is highly appreciated.
> ---
>  drivers/iio/adc/ad7292.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7292.c b/drivers/iio/adc/ad7292.c
> index 92c68d467c50..a2f9fda25ff3 100644
> --- a/drivers/iio/adc/ad7292.c
> +++ b/drivers/iio/adc/ad7292.c
> @@ -287,10 +287,8 @@ static int ad7292_probe(struct spi_device *spi)
>  
>  		ret = devm_add_action_or_reset(&spi->dev,
>  					       ad7292_regulator_disable, st);
> -		if (ret) {
> -			regulator_disable(st->reg);
> +		if (ret)
>  			return ret;
> -		}
>  
>  		ret = regulator_get_voltage(st->reg);
>  		if (ret < 0)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ